Microsoft
Software
Hardware
Network
Question : simple json example not working
Hi , it is an example from the book jquery 1.3 with php
but for some reason i can't get the callback function to work (this is what i think)
$.getJSON(
'delete.php?ajax=true?id='
+id,
remove_row
);
delete.php:
<?php
$id = (int)$_REQUEST['id'];
echo (!($id%2)) ?
"{'id':$id,'success':1}":
"{'id':$id,'success':0,'er
ror':'Coul
d not delete subscriber'}";
?>
function remove_row(data)
{
if (!data.success) return alert(data.error);
$('#delete_link_'+data.id)
.closest('li')
.remove();
}
if i call e.g. delete.php?id=6 alone it echoes back json data, but remove_row does not seem to be called
Answer : simple json example not working
The JSON being returned is incorrect. It currently is
{'id':$id,'success':1}
while it should be
{"id":$id,"success":1}
i.e. use double quotes for string instead of single quotes.
Random Solutions
Show All Records In Query if Nothing Selected in Listbox - Part II
Fix NMIndexStoreSvr.exe error [5296]
Windows Server 2003 Intermittent Freezing Issues
Exchange 2003 - Storage groups are dissmounting with backup softwere
Start applications from command promt
With PHP, what is the best way of detecting a user based on IP and updating it accordingly?
VirtualInfrastructure.Util
s.HttpWebR
equestProx
y' threw an exception.
POP UP error in MS-CRM
mcafee 4.5 issue cant see the agent logs
Cisco ASA 5520