I am still trying to figure out how to use json.. can someone please help me understand how to deal with this response. My query is :
$.ajax({
url: s7query,
dataType: 'jsonp',
success: function(){
// how do I deal with the response?
}
});
The json I am querying returns (with either a 1 or 0):
s7jsonResponse(
{"catalogRecord.exists":"1"},"");
All I need from this is the number and put that into a variable so I can then run conditional logic against that result. Thanks for any help understanding this…
If I try and handle the success with any function firebug just returns that s7jsonResponse is not defined. I tried to define it as a variable outside of the request. Now I see in firebug it is returning the json from all the requests, however it is returning them as errors and now says s7jsonResponse is not a function. I think I am close.. please help!
Ok, I missed the json
ppart! All you need is to define a method for s7jsonResponse.See this for details on JSONP
initial response
I noticed thatcatalogRecord.exists, this has a.in it and it won’t extract. If you don’t have a strong reason to do so, you could change it tocatalogRecordExistsand use below solution.Note:
The data that you send back should =
{"catalogRecord.exists":"1"}You can use $.getJSON to do the same(it internally calls
$.ajax)