Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  4] [ 3]  / answers: 1 / hits: 20154  / 9 Years ago, wed, october 14, 2015, 12:00:00

I am trying to get the response of this url. But when I check the console error message appears:

Uncaught TypeError: response is not a function

What is the possible problem?

var uri = pbxApi+/conference/participants/+circle+/+data.conference+/+data.uniqueid+'?jsonp=response';
getJsonData(uri, function(res){

This is my function.

var getJsonData = function(uri,callback){
type: GET,
dataType: jsonp,
url: uri,
jsonpCallback: 'response',
cache: false,
contentType: application/json,
success: function(json){

this is my response:


More From » jquery


As it is written here:

Type: String or Function()
Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.

So by setting jsonpCallback property of your ajax object, you are passing a name of a function (or a function itself from jQuery 1.5) that should be treated as a callback. That means that if you set its value to 'response', a response() function should be declared.

[#64749] Sunday, October 11, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 498
Total Questions: 91
Total Answers: 89

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago