javascript - Appending an extra request to JSON callback -


my problem

i trying load json encoded data remote site using jquery, when jquery tries call url appends correct function callback=? it's callback=jsonp1256856769 adds _=1256856769 url. url ends being http://www.example.com/link/to/file.php?format=json&lang=en&callback=jsonp1256856769&_=1256856769

now problem that file using calls can't interpret _=1234234 , can't change have fix jquery problems

my question

how can jquery not appened _= url calls

what have done try figure out problem

  • removed other javascript libraries page
  • tried several different versions of jquery

my code

function getdata(){     url = "http://www.example.com/link/to/file.php";     url += "?format=json&lang=en";     $.getjson(url+"&callback=?",function(data){formatdata(data);}); } 

*above snippet of javascript using

*note domain using not example.com

update: added code

the _= part there, because jsonp request cache: false default. can set cache: true, make _= part go away, browser cache requests.

function getdata() {     url = "http://www.example.com/link/to/file.php";     url += "?format=json&lang=en";     $.ajax({         'url': url,         'type': 'get',         'datatype': 'jsonp', // adds &callback=? design         'cache': true,         'success': function(data) { formatdata(data); }     }); } 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -