Reputation: 298
I'm new to both Ajax and Javascript, and I'm having a heck of a time figuring out why this request is always failing:
function sellStock(sellData){
$.ajax({
url: '../controller/sell.php',
data: sellData,
success: function(){
alert("MADE IT");
//does stuff
}
});
}
The only data I can get back about the failed request is "error." What's the best way to get more info about the problem?
I'm especially confused because this almost-identical function works perfectly on a php file from the same directory:
function autoUpdate(s){
$.ajax({
url: '../controller/quote.php',
data: {symbol: s},
success: function(data){
//does stuff
}
});
}
There are slight differences between the calls (i.e. autoUpdate() is called from setInterval() while sellStock() is called in a loop by another JS function) but I can't see that any would be a problem. I'm confident that sellData is in the right form. I've accessed each member that should be there, and, just in case, I've tried it with an anonymous object with the same result.
Can anyone lend me a hand?
Upvotes: 1
Views: 382
Reputation: 8337
composer
tab try to hand-serialize the payload sellData
and keep debugging.Something above should give you a clue to what went wrong.
Upvotes: 4