RSS

Cross Domain requests when using JQuery Autocomplete

25 Mar

When using the JQuery control with AJAX web requests for example, it is likely that the data used to populate the auto complete is stored on another security domain.  As a result you ma have found that the list fails to appear and you start to bang your head against a table wondering why.

In order to ensure the auto complete continues to function correctly across domains the trick is to set the datatype of the ajax request to “jsonp” e.g.

Sample JQuery autocomplete using an ajax call

Sample JQuery autocomplete using an ajax call

Advertisements
 
 

2 responses to “Cross Domain requests when using JQuery Autocomplete

  1. proudsalopian

    October 21, 2013 at 2:37 pm

    I’ve added a link to the wikipedia definition for JSONP John as I have today come across this from the opposite angle with regards to KendoUI grid controls not expecting in my instance a JSONP datatype. It helped me to understand what JSONP actually is.

    http://en.wikipedia.org/wiki/JSONP

     
    • westcountrydeveloper

      October 21, 2013 at 4:14 pm

      Cheers Conrad, always finding an exception to the rule. very useful though

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: