Reputation: 3850
function selectTinNumber(object){
$.ajax({
url: '..//include/crud.php',
data: 'pin=' + object.value,
cache: false,
error: function(e){
alert(e);
},
success: function(e){
// A response to say if it's updated or not
alert(e);
}
});
}
i have this code for ajax i want to use it to select query my database in my crud.php i have a function called selectAllPin()
, where i use data pin
. I use pin
as if(isset($_GET['pin'])){
my question is why do i always get alert like this object Object
.. How do i connect my function selectAllPin()
to this ajax any help is appreciated
Upvotes: 0
Views: 46
Reputation: 4637
function selectTinNumber(object){
$.ajax({
url: '../include/crud.php?pin=' + object.value,
cache: false,
error: function(e){
alert(e);
},
success: function(e){
// Response here
alert(e);
}
});
}
Upvotes: 1
Reputation: 604
Use console.log to the the content or JSON.stringify, that should help. I think the data can be found with e.data.
Upvotes: 0
Reputation: 7405
You get Object object because the thing you are alerting is object. You would need to read it's appropriate attributes such as e.result
. If you want to see what all the object contains, you can use this
for (var i in e)
{
alert(i + ": " + e[i]);
}
to iterate through all attributes of object e.
Upvotes: 0