Welcome Guest, Not a member yet? Register   Sign In
Help with adding a jquery alert box after form is correctly submitted
#13

[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 $arrayWink 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?


Messages In This Thread
Help with adding a jquery alert box after form is correctly submitted - by El Forum - 05-12-2010, 03:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB