Posted By

bcmoney on 12/10/10


Tagged

http ajax JSONP proxy


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wirenaught


proxy.js


 / Published in: JavaScript
 

URL: http://bcmoney-mobiletv.com/blog/2009/05/01/the-server-side-proxy/

Several useful resources for JSONp: http://www.west-wind.com/weblog/posts/107136.aspx

http://insideria.com/2009/03/what-in-the-heck-is-jsonp-and.html

http://remysharp.com/2007/10/08/what-is-jsonp/

http://www.ibm.com/developerworks/library/wa-aj-jsonp1/

http://jpgmr.wordpress.com/2010/07/28/tutorial-implementing-a-servlet-filter-for-jsonp-callback-with-springs-delegatingfilterproxy/

http://bob.pythonmac.org/archives/2005/12/05/remote-json-jsonp/

  1. function jsonp(url,callback,name, query)
  2. {
  3. if (url.indexOf("?") > -1)
  4. url += "&jsonp="
  5. else
  6. url += "?jsonp="
  7. url += name + "&";
  8. if (query)
  9. url += encodeURIComponent(query) + "&";
  10. url += new Date().getTime().toString(); // prevent caching
  11.  
  12. var script = document.createElement("script");
  13. script.setAttribute("src",url);
  14. script.setAttribute("type","text/javascript");
  15. document.body.appendChild(script);
  16. }

Report this snippet  

You need to login to post a comment.