Ajax call is not calling to the server side and in httpfox shows error as “Error loading content (NS_ERROR_DOCUMENT_NOT_CACHED)” in ajax post call

后端 未结 3 1021
北恋
北恋 2021-01-23 09:53

Here I am making a simple ajax post call from my asp.net page which shows following error on httpfox. \"Error loading content (NS_ERROR_DOCUMENT_NOT_CACHED)\" and

         


        
3条回答
  •  旧巷少年郎
    2021-01-23 10:18

    Try this:

    $('#btnResult').on('click', function () {
            var myArray = [];
    
            $("#<%=GridProjectDetails.ClientID %>  tr").each(function () {
                var id = $(this).find("input[name*='ID']").val();
                var locationcode = $(this).find("input[name*='TextLocationCode']").val();
                var Location = $(this).find("input[name*='TextLocation']").val();
                var myObject = new Object();
                myObject.id = id;
                myObject.locationcode = locationcode;
                myObject.Location = Location;
                myArray.push(myObject);
            });
    
            var myString = JSON.stringify({details: JSON.stringify(myArray)});
            alert(myString);
            var exportdata = myString;
    
            $.ajax({
                type: "POST",
                url: "Default.aspx/ExportToExcel",
                data: exportdata,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#Result").text(data.d);
                },
                error: function () { alert(arguments[2]); }
            });
        });
    });
    

提交回复
热议问题