[eluser]LuckyFella73[/eluser]
For the json encoding you can do it like Posted but
when running PHP 5 you can write something like
Code:
$json = json_encode(array('message' => 'your data has been saved'));
echo $json;
// instead of:
$array = '{ "message" : "Your data has been saved" }';
echo $array;
Quote:after I submitted the form correctly, it just printed $array as what (echo $array
in the last line does.
Sounds like you get a white page just with exactly this output?
Quote:{ "message" : "Your data has been saved" }
Try this in your js:
Code:
// ...
$.post("form/add_person", { "fname" : item, "email" : item },
function(data) {
alert("The callback function returned somthing");
}, 'json');
// ...
Don't you get a js alert box when submitting the form correctly
while the page containing the form stays like before submitting?