1
i ont ce codepourquoi cette jquery ne déclenchera pas la requête .ajax()?
// jquery
$(document).ready(function() {
$('#update_point').live("change", function() {
var point_val = $('#update_point').val();
$.ajax({
url: 'send/user/update_point.php',
type: 'get',
data: 'point='+point_val,
dataType: 'json',
success: function(data){
alert(data);
$('#update_point_result').html(data);
}
});
return false;
});
});
pourquoi ce code n'a pas tiré? mais si je supprime dataType, le code fonctionne. Pourquoi ?
// jquery
$(document).ready(function() {
$('#update_point').live("change", function() {
var point_val = $('#update_point').val();
$.ajax({
url: 'send/user/update_point.php',
type: 'get',
data: 'point='+point_val,
success: function(data){
alert(data);
$('#update_point_result').html(data);
}
});
return false;
});
});
toute aide sera appreaciate! Merci!
modifier
update_point.php contient ce code.
<?php
require "../../inc/json.php";
if($_GET){
foreach($_GET as $key=>$val){
$respon[$key] = $val;
}
}
// initialitation json object
$json = new Json();
echo $json->encode($respon);
die();
?>
me retourner l'alerte "[object Object]" pourquoi? –
Je ne suis pas sûr. Assez sûr que votre problème est mal formé JSON. Comme je l'ai dit, passez par JSONlint pour savoir où est le problème. – karim79