Pappa Bear, note that the original problem was that upon executing
"return true" the submit action would take the browser to a new page.
Kirov (if I understood him correctly) suggested to "wait for a result
code from the POST request before returning true". Now, in Java for
example, I would take t
You can with ajax... depending on the result that is returned, you can
have your script perform various things. If the result returns with a
success for the call, you can call one thing, while if returns a
failure, you can, say alert the user with a message. Even single
threads allow for multiple
you can call a function when web service returns the result of the
page that database already saved the info:
function otherajaxcall(pa,ra,me,ter){
$.ajax({
type: "POST",
url: "someother.php",
data: "age=25&gender=male",
success: function(msg){
alert(msg);
}
}
Sorry, in my earlier post I got a little confused with the bind/unbind
semantics.
This code should be better:
function save_data() {
var bound_form = $(this);
$.post("/save_data.php", { name: "opt-in name", email: "opt-in
email" }, function() {
bound_form.unbind("submit", save_da
You can't "wait for a result before returning", there is no waiting
mechanism (only timers) and Javascript is single-threaded anyway, so
nothing will happen until you return.
What you should do is return false, and perform a manual submit of the
form once the POST is done. Now, this might be trick
I think you should wait for a result code from the post request before
you return true; otherwise the post is handled asynchronously and
perhaps not done according to your plans :)
Good luck;
On Jul 14, 4:49 pm, Sandy <[EMAIL PROTECTED]> wrote:
> hi,
>
> i wanna try to save the data from a form
this is fixed now:
i changed this: $("form:last").bind("submit", submit_optin);
to: $("form:last").find(":submit").bind("submit",
submit_optin);
On Jul 14, 9:49 pm, Sandy <[EMAIL PROTECTED]> wrote:
> hi,
>
> i wanna try to save the data from a form to a database before
> submitt
7 matches
Mail list logo