angularjs - JSON_CALLBACK not found using JSONP -


i trying jsonp response working using following code...

$http.jsonp('http://example.com:8888/?callback=json_callback').success( function( response ) {     console.dir( response ); }); 

http://example.com:8888/?callback=json_callback returns following via node.js

json_callback({ date:'2013-05-15t08:53:51.747z' });

the header being set in node.js this....

res.writehead(200, {'content-type': 'application/json'}); 

yet error in chrome console this...

uncaught referenceerror: json_callback not defined  

however, weirdly, if create function window.json_callback(response) run. thought success meant on behalf.

your content-type header not correct.

use application/json if return plain json. jsonp javascript, should use application/javascript


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -