Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I'm facing a unique problem of firefox and i.e
when I passed a function from $.AJAX with datatype as JSON then that function (provided in url with some parameter) will not execute
Note :- I'm using both onclientclick event and button click event on the same button

And when I'm debugging from firefox by placing breakpoint inside $.ajax, then that function which I passed inside $.AJAX will execute first.

Tell me why this is happening and what is the solution of this typical problem.

Here is some snippet which is not working properly:-

.aspx file
<asp:Button ID="btnSubmit" Text="Proceed" runat="server" OnClientClick="myFunction();"
            OnClick="btnSubmit_Click" />


Javascript code is:-
function myFunction() {
    $.ajax({
        type: "POST",
        url: "pageName.aspx/CallFunction",
        data: "{'valArray': '" + JSON.stringify(variable) + "'}",
        contentType: "application/json",
        dataType: "json",
        success: function () {
            //success function
        },
        error: function () {
            //failure function
        }
    });
}



P.S :- In google Chrome it is working perfectly

Thanks in Advance
Posted
Updated 31-Jul-15 3:25am
v3
Comments
F-ES Sitecore 31-Jul-15 9:12am    
Google for examples of using ajax and you'll find loads. If they don't solve your issue then you'll need to post your code as we can't access your system.
Sergey Alexandrovich Kryukov 31-Jul-15 9:15am    
Ajax does work properly with Firefox, jQuery Ajax, too.
—SA
Sinisa Hajnal 31-Jul-15 9:25am    
It should work in all browsers, I know, I tried it. Do some research, the error is in your code. Post your code if you don't find the error. Get Firebug plugin, it may help with FF debugging.
binadi007 31-Jul-15 9:27am    
I debug it a lot of time.....if I debug then the CallFunction runs (function name as shown in above code)......if not debug then not run
ZurdoDev 31-Jul-15 12:39pm    
It will either call your success function or your error function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900