0

I am getting $.jsonp is not a function error. Have included js from this link: http://cloud.github.com/downloads/jaubourg/jquery-jsonp/jquery.jsonp-2.4.0.js

Any thing else needs to be included. Checking in firefox 25.0v.

Code used is:

$.jsonp({
  "url": "http://gdata.youtube.com/feeds/api/users/123456?callback=?",
  "data": {
      "alt": "json-in-script"
  },
  "success": function(userProfile) {
      alert("Could not find user ");
  },
  "error": function(d,msg) {
      alert("Could not find user ");
  }
});

This was sample code given at site: https://github.com/jaubourg/jquery-jsonp/blob/master/doc/TipsAndTricks.md

halfer
  • 19,824
  • 17
  • 99
  • 186
xyz
  • 3
  • 1
  • 3

1 Answers1

0

If you are not strict with

$.jsonp();

then You can use jsonp ajax request like below as well:

$.ajax({
dataType: "jsonp",
url: "http://gdata.youtube.com/feeds/api/users/123456?callback=?",
"data": {
  "alt": "json-in-script"
 },
 "success": function(userProfile) {
  alert("Could not find user ");
 },
  "error": function(d,msg) {
  alert("Could not find user ");
 }

dataType: "jsonp"

will be useful for your jsonp call.

Pramod S. Nikam
  • 4,271
  • 4
  • 38
  • 62
  • before I was using $.ajax,but it does not do proper error handling hence was not able to handle exceptions like on session timeout etc. check http://stackoverflow.com/questions/19035557/jsonp-request-error-handling – xyz May 21 '14 at 07:23
  • You can also use jQuery ajax Timeout for handling timeout – Pramod S. Nikam May 21 '14 at 07:32
  • yes.but we need to handle for status 12029,0,500 error also – xyz May 21 '14 at 09:32