My problem basically is that I cannot figure out the proper syntax (never used JSON before), both on the js and PHP side but I think I can figure the PHP side out myself once I figure out the js.
Logical goal: send JSON data storing variable id# and constant string 'del' , receive JSON data that is contains success/error information, and then based on success/error, echo results into different html. I am most interested in learning the javascript code on sending and processing received json, I think the PHP handling should be more straightforward to figure out on my own (hopefully).
edit -- when i say success/error, i want that to be determined in the PHP code and not a TRUE hard error. so maybe it's better to think of it as just, an if
statement in the callback function portion of the jQuery.
$(".admin_ru_delete_button").click(function() { //this code is not working
id = ($(this).attr("id"));
dataJson = { "id":id, "type":"del" };
$.post(
'ajax/justPosted_AJAX.php',
dataJson,
function(data){
//$("#admin_errors").html('');
//$("#admin_success").html('');
}
, "json");
return false;
});
Thanks a lot for your time/help!