开发者

Ajax call is not working in Firefox but it is working fine in IE

开发者 https://www.devze.com 2023-04-12 11:30 出处:网络
Ajax call is not working in Firefox but it is working fine in IE. jQuery.ajax({ type: \'POST\', url: \'../Chart/CreateChart\',

Ajax call is not working in Firefox but it is working fine in IE.

  jQuery.ajax({
                type: 'POST',
                url: '../Chart/CreateChart',
                //url: '../Chart/Cre开发者_如何学PythonateChart?chartType=Pie&a=null',
                success: function (result) {
                alert("work successfully...1");
                }
            });


Try this

  $.ajax({
                type: "POST",
                cache: false,
                url: '<%= Url.Action("Chart", "CreateChart") %>',
                success: function (result) {
                   alert("work successfully...1");
                },
                error: function (result) { alert('error '); }
            });

Use Url.Action("Chart", "CreateChart") . I wrote that in mvc2


By looking at your URL you need to use a GET

 $.ajax({
      type: "GET",
      url: "<%= Url.Action("Chart", "CreateChart") %>",
      data: "chartType=" + chartType + "&a=" + a,
      success: function (result) {
            alert("work successfully...1");
            }
 });


This thread is very old, but I have faced the similar issue and finally fixed it. So I thought this solution might help for others.

You may using asp.net button control instead of html button to trigger your ajax call. Please replace the button with simple input button control and verify, it should work properly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号