web services - Jquery $.getJSON adds script tag to head -


i debugging , noticed whenever call webservice $.getjson plugin webservice url gets added script tag in head of html split seconds , dissappears again. script tag has async property.

is normal behaviour ?

$.getjson(options.url, function(data) {                 self.address = data;                 self.addresswscallback();             }); 

according jquery cookbook cody lindley

if request cross-domain, jquery automatically treat request jsonp , fill in appropriate callback function name. means jquery initiate request inserting tag document instead of using xmlhttprequest object.

cross-domain requests in javascript jsonp relies on fact tags can have sources coming different origins. when browser parses tag, script content (residing on origin) , execute in current page’s context. normally, service return html or data represented in data format xml or json. when request made jsonp-enabled server however, returns script block executes callback function calling page has specified, supplying actual data argument.


Comments

Popular posts from this blog

SQL php on different pages to Insert (mysqli) -

php - How can an email be returned from Stripe Checkout? -

sql - Partition elimination in Greenplum -