[support] jQuery.ajax returns 404
Scott
scott at bscottholmes.com
Fri May 21 21:18:43 UTC 2010
I'm still experimenting with a new citysearch module. I've managed to
fetch back the json with curl but I'd still like to let ajax handle it.
I have this function but it reports a 404 error. Is there a way to
determine the url value actually being sent? The generated value I'm
using here works both with window open() and with my curl function.
My code:
function processSearch(form) {
var what = js_trim(form.what.value);
var where = js_trim(form.where.value);
var loc = js_trim(form.location_or_event.value);
var publisher = js_trim(form.publisher.value);
var api_key = js_trim(form.api_key.value);
var URL = 'api2.citysearch.com/search/'+loc+'?what='+what
+'&where='+where+'&format=json&publisher='+publisher
+'&api_key='+api_key;
alert(URL);
$.ajax({
type: 'get',
url: URL,
dataType: 'jsonp',
success: function() { alert("Some success"); },
error:function (xhr, ajaxOptions, thrownError){
alert(xhr.status);
alert(xhr.statusText);
alert(xhr.responseText);
}
}); // end ajax method
}
function js_trim(str) {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
More information about the support
mailing list