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
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);
}
});
}
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 .
Use console.log to the the content or JSON.stringify, that should help. I think the data can be found with e.data.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.