Well, my problems is a little wierd,
I have an AJAX Request to get just a number.
That number is printed on: getMoney.php.
On index.php i have the AJAX request.
Ajax Code:
function getMoney(selected)
{
if(selected.value != -1)
{
// Obtener presupuesto via AJAX
$(document).ready(function(){
$.ajax({
url: "getMoney.php",
async: true,
success: function(datos){
//My action
}
});
});
}
}
The function is called when I change a value on a Combobox HTML
<select name="area_id" onchange="getMoney(this);">
Well… My problem:
If i write down the numbers on getMoney.php (mannualy) its works perfectly, the AJAX’s get it and the action is done, but when i get the numbers from my database i just get 0. I open mannualy too the getMoney.php, and the numbers ARE THERE! even if i get it from the Database.
What’s wrong?
make sure that getMoney.php is NOT using your standard view headers, i.e. script includes, stylesheet includes or anything else. Also, it’s better practice to have getMoney.php to return a JSON string with your data parametized that way you can pull back diagnosic and error codes as well as specific data. this will help in debugging. look at $.getJSON() if you need help with that.