issue with sending ajax message

matraxboy

New Member
Newbie to JQuery / JSON / AJAX so please be nice.I've pieced together this artwork from examples on SO and other sites, but I'm struggling.I've created some functions to deal with the AJAX response...\[code\]function newOrderSuccess(response) { ... }function newOrderTimeout() { ... }function newOrderFail() { ... }\[/code\]...Here is the AJAX call:\[code\]function sendCallAjaxUsingJson(theUrl, theData, successCallbackFunction, timeoutCallbackFunction, otherErrorCallback, timeoutValueMilli){var successFn = successCallbackFunction; var timeoutFn = timeoutCallbackFunction; var otherFn = otherErrorCallback;if(!(typeof successFn === 'function') || !(typeof timeoutFn === 'function') || !(typeof otherFn === 'function')) return false;$.ajax({ type: "POST", url: theUrl, timeout:timeoutValueMilli, dataType: 'json', data: { json: JSON.stringify(theData) }, success:successFn(result), error: function(x, t, m) { if(t==="timeout") { timeoutFn(); } else { otherFn(); } } });\[/code\]}My code calls the function as follows:\[code\]sendCallAjaxUsingJson("/ordertaker.php", 'submitOrder','newOrderSuccess', 'newOrderTimeout', 'newOrderFail',1000);\[/code\]The result is..... nothing. I was getting to the \[code\]newOrderFail()\[/code\] function before I uploaded the \[code\]ordertaker.php\[/code\] file, but now I get nothing.Where did I go wrong?
 
Back
Top