-1
$.save1= function(){
    var value = $("form#form1").serialize();
    send(value);
}

$.save2= function(){
    var value = $("form#form2").serialize();
    send(value);
}

$.save3= function(){
    var value= $("form#form3").serialize();
    send(value);
}

$.send= function(value){
    value = value + "&do=titlechange";
    $.ajax({
        url: "php_script.php",
        data: value,
        dataType: "json",
        type:"post",
        success: function(res){
            alert(res);     
        }
    });
}

I have 3 different form in same page. Also i have 3 different button, but i want to send values to same .php file. My code is above, but i could not call send function, in "save" functions. Save functions are binded buttons onclick.

1
  • OK, so what's the question? Commented Jan 24, 2015 at 11:30

1 Answer 1

2

Replace send(value); with $.send(value); as you're creating function with variable name $.send.

$.save1= function(){
    var value = $("form#form1").serialize();
    $.send(value);
}

$.save2= function(){
    var value = $("form#form2").serialize();
    $.send(value);
}

$.save3= function(){
    var value= $("form#form3").serialize();
    $.send(value);
}

$.send= function(value){
    value = value + "&do=titlechange";
    $.ajax({
        url: "php_script.php",
        data: value,
        dataType: "json",
        type:"post",
        success: function(res){
            alert(res);     
        }
    });
}
Sign up to request clarification or add additional context in comments.

1 Comment

thank you buddy, it works :) i will accept in 11 min

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.