$ .Ajax在firefox中无法正常工作 [英] $.Ajax is not working properly in firefox

查看:65
本文介绍了$ .Ajax在firefox中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





当我从$ .AJAX传递一个函数时,我遇到了一个独特的firefox问题,即

数据类型为JSON然后该函数(在带有一些参数的url中提供)将不会执行

注意: - 我在同一个按钮上同时使用onclientclick事件和按钮点击事件



当我通过在$ .ajax中放置断点来从firefox调试时,我在$ .AJAX中传递的函数将首先执行。



告诉我为什么会发生这种情况以及这个典型问题的解决方案是什么。



这是一些无法正常工作的片段: -



.aspx文件

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代码为: -



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
        }
    });
}







PS: - 在谷歌浏览器中它完美运行



感谢提前




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

Thanks in Advance

推荐答案

.AJAX,数据类型为JSON,然后该功能(在url中提供了一些参数)将不执行

注意: - 我在同一个按钮上同时使用onclientclick事件和按钮点击事件



当我正在调试时从firefox中放置断点
.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,然后我传入的函数
.ajax, then that function which I passed inside


.AJAX将首先执行。



告诉我为什么会发生这种情况以及这个典型问题的解决方案是什么。



这是一些不起作用的片段正确: -



.aspx文件

.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代码为: -



Javascript code is:-

function myFunction() {


这篇关于$ .Ajax在firefox中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆