0

I am using jquery ajax to post a html form . This works fine with Chrome and not with Firefox . When I analyze the issue ,the query parameter "Accept=Apply" is not shown in Firefox dev tool (Params tab)but I could see the proper string is in debug statement which i have added. Can anyone help on this?

Jquery :

function postSettings() {
    var frm_data = $("#MyForm").serialize() + "&Accept=Apply";
    console.log("frm_data >>"+frm_data);
    var myobject = {"Accept":"Apply"};
    var testdata =$("#MyForm").serialize() + '&' + $.param(myobject);
    console.log("testdata >>"+testdata);
    $.ajax(
        {
            type: "POST",
            url: "https://10.20.12.30/Update.cgi",
            data: frm_data,
            success: function (successData) {
                console.log("successData >>"+successData);
                } else {
                    console.log("errorData1 >>"+successData);
                }
            },
            error: function (errorData) {
                console.log("errorData2 >>"+errorData);
            }
        });
}

Thanks

4
  • 1
    quick suggestion, try adding 'Accept' as hidden field and try again? Commented Mar 22, 2016 at 11:49
  • Thanks ssilla . it worked . Great. Commented Mar 23, 2016 at 6:22
  • Great, Shall I post it as an answer? Commented Mar 23, 2016 at 6:49
  • Sure . Please . I will mark it as correct answer Commented Mar 23, 2016 at 9:43

1 Answer 1

2

Best way to do this would be adding it as a hidden field

<input type="hidden" id="Accept" name="Accept" value="apply"/>

This way we can aviod passing it as query string and unexpected issues.

Sign up to request clarification or add additional context in comments.

Comments

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.