Ajax filter in exposed view not working I am embedding a view as such: 

function theme_module_name_element($element) {
  $view = views_get_view('view_name');
  $view-&gt;set_use_ajax(TRUE);
  $output = $view-&gt;render();
  return $output;
}


The view is displayed then by the filefield sources module but when you try to search it won't use ajax. I'm assuming this has something to do with the js not being loaded but I just can't figure out how to get this going!

Any ideas?

Edit: This might be related to this: http://drupal.org/node/386388

Edit 2: The pager works and when it has been used the search works...

Edit 3: When the pager is pressed (and everything works fine) there is html added to the form so it goes from:

(Edit 3 update: If I had to guess I would say "Drupal.behaviors.ViewsAjaxView" from ajaxViews.js isn't being executed when the filefield_sources source is being chosen.)

&lt;div class="view-filters"&gt;
    &lt;div&gt;&lt;div class="views-exposed-form"&gt;
        &lt;div class="views-exposed-widgets clear-block"&gt;
            &lt;div class="views-exposed-widget views-widget-filter-title"&gt;
                &lt;label for="edit-image-title"&gt;Search&lt;/label&gt;
                    &lt;div class="views-widget"&gt;
                        &lt;div class="form-item" id="edit-image-title-wrapper"&gt;
                            &lt;input type="text" maxlength="128" name="image-title" id="edit-image-title" size="30" value="" class="form-text"&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
                &lt;div class="views-exposed-widget views-submit-button"&gt;
                    &lt;input type="submit" id="edit-submit-Filefield-Sources-Imagebrowser" value="Apply" class="form-submit"&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


to:

&lt;div class="view-filters"&gt;
    &lt;form action="/" accept-charset="UTF-8" method="get" id="views-exposed-form-Filefield-Sources-Imagebrowser-default" class="views-processed"&gt;
        &lt;div&gt;&lt;div class="views-exposed-form"&gt;
            &lt;div class="views-exposed-widgets clear-block"&gt;
                &lt;div class="views-exposed-widget views-widget-filter-title"&gt;
                    &lt;label for="edit-image-title"&gt;Search&lt;/label&gt;
                        &lt;div class="views-widget"&gt;
                            &lt;div class="form-item" id="edit-image-title-wrapper"&gt;
                                &lt;input type="text" maxlength="128" name="image-title" id="edit-image-title" size="30" value="arnar" class="form-text"&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                    &lt;div class="views-exposed-widget views-submit-button"&gt;
                        &lt;input type="submit" id="edit-submit-Filefield-Sources-Imagebrowser" value="Apply" class="form-submit"&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;input type="hidden" name="view_name" value="Filefield_Sources_Imagebrowser"&gt;
        &lt;input type="hidden" name="view_display_id" value="default"&gt;
        &lt;input type="hidden" name="view_args" value=""&gt;
        &lt;input type="hidden" name="view_path" value="node/add/dagskrafaerslur"&gt;
        &lt;input type="hidden" name="view_base_path" value="null"&gt;
        &lt;input type="hidden" name="view_dom_id" value="655136b3027e2ef4608dfbaa7605db4c"&gt;
        &lt;input type="hidden" name="pager_element" value="0"&gt;
    &lt;/form&gt;
&lt;/div&gt;


(Notice the addition of the form tag and input elements.)
Enable the Ajax in Views Basic Setting and remove $view-&gt;set_use_ajax(TRUE); and check.