Ive been working on some jquery within a a page. Now all of a sudden the post functions seem to have stopped working?
function deleteRow(OrderNo, LineNo) {
alert(OrderNo + ";" + LineNo);
$.ajax({
type: "POST",
url: "Ajax.aspx/DeleteRow",
data: '{' + 'OrderNo:"' + OrderNo + '",' + 'LineNo:"' + LineNo + '"' +
'}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
//$("#item").val(msg);
var data = jQuery.parseJSON(msg);
if (!data.error) {
$('#' + LineNo).remove();
}
else {
alert("Error" + " " + data.error);
}
},
error: function (msg) {
alert('Failure: ' + msg);
}
});
}
This is a jquery function which gives an error back 'Failure [object Object]'
the function DeleteRow does exist in Ajax.aspx and does work. Cant understand why all of a sudden the post functions would stop working??
[WebMethod]
public static string DeleteRow(string OrderNo, string LineNo)
{
SqlConnection myConnection = new SqlConnection(connStr);
myConnection.Open();
//Check if param exisits
string SQLst = "Delete from Saved_Order_Import where [Order No] = '"+OrderNo+"' And [Line No] = '"+LineNo+"'";
try
{
SqlCommand myComman = new SqlCommand(SQLst, myConnection);
myComman.ExecuteNonQuery();
}
catch (Exception ex)
{
myConnection.Close();
return "{\"error\":\"Error Line Not Deleted" + ex.ToString() + "\"}";
}
myConnection.Close();
return "{\"Success\":\"Line Deleted\"}";
}
console log
abort: function ( statusText ) {
always: function () {
complete: function () {
done: function () {
error: function () {
fail: function () {
getAllResponseHeaders: function () {
getResponseHeader: function ( key ) {
isRejected: function () {
isResolved: function () {
overrideMimeType: function ( type ) {
pipe: function ( fnDone, fnFail ) {
promise: function ( obj ) {
readyState: 4
responseText:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
</title></head>
<body>
<form name="form1" method="post" action="Ajax.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE2MTY2ODcyMjlkZAZAz479BJ9BS5KpwM0PauBgztmI" />
</div>
<div>
</div>
</form>
</body>
</html>
"
setRequestHeader: function ( name, value ) {
status: 200
statusCode: function ( map ) {
statusText: "parsererror"
success: function () {
then: function ( doneCallbacks, failCallbacks ) {
__proto__: Object