I'm trying to write a simple JSON post and the callback alert does not show
up no matter what I do. I used firebugs to see if the post was getting any
response and "SHOE" returns. So why is the alert not working in the
callback?
view code:
$('#GaragePartAddfrompartlistForm').click(function() {
var item = "CHEESE";
$.post("garage_parts/getlastid", { 'item' : item },
function(data){
alert(data.result);
}, "json");
});
controller code:
function getlastid() {
$newid = "SHOE";
$array = array('result' => $newid);
echo json_encode($array);
}
--
View this message in context:
http://www.nabble.com/Jquery-JSON-Ajax-Callback-Not-Working-tp25966995p25966995.html
Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---