jquery ajax error cannot find url outside of debug mode
- by John Orlandella Jr.
I inherited some code two weeks ago that is using the jquery.ajax method to connect to a .NET web service. Here is the piece of code give me the trouble...
if (MSCTour.AppSettings.OFFLINE !== 'TRUE') {
$.ajax({
url: url,
data: json,
type: "POST",
contentType: "application/json",
timeout: 10000,
dataType: "json", // not "json" we'll parse
success: function(res){
if (!callback) {
return;
}
/*
// *** Use json library so we can fix up MS AJAX dates
*/
var result = "";
if (res !== "") {
try {
result = $.evalJSON(res);
}
catch (e) {
result = {};
bare = true;
}
}
/*
// *** Bare message IS result
*/
if (bare) {
callback(result);
return;
}
/*
// *** Wrapped message contains top level object node
// *** strip it off
*/
for (var property in result) {
callback(result[property]);
break;
}
},
error: function(xhr,status,error){
if (status === 'parsererror') {}
else {return error;}
},
complete: function(res, status){
if (callback) {
if ((status != 'success' && status != 'error') || status === 'parsererror' || (status === 'timeout' && res !== '')) {
try {
result = $.secureEvalJSON(res);
}
catch (e) {
result = {};
bare = true;
}
callback(res);
}
}
return;
}
});
}
The url variable at this point equals /testsite/service.svc/GetItems
Now here is where my problem lies...
When running this site out of debug mode through visual studio I am not having any problem connecting to the database through the web service and seeing all my data, for both viewing and updating. When I go through the normal web server for the same site, on the same page, no data is showing up. When I put a break on the error portion of the code above in firebug this is information I am getting in the image linked below.
link text
I am getting what appears to be a 404 error, but when I look on the server all of the files are in the right place... coupled with the fact that it works when in debug mode, I think I am slowly going crazy staring at these same lines of code trying to find the needle in the haystack. Any help or just a direction to look in would be greatly appreciated.