Skip to main content
added 65 characters in body
Source Link
George Mauer
  • 122.9k
  • 140
  • 401
  • 632

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?

By the way I make sure I invoke this at the top of the page:

 jQuery.ajaxSettings.traditional = true

UPDATE: See comments in Steven's answer below for resolution.

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?

By the way I make sure I invoke this at the top of the page:

 jQuery.ajaxSettings.traditional = true

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?

By the way I make sure I invoke this at the top of the page:

 jQuery.ajaxSettings.traditional = true

UPDATE: See comments in Steven's answer below for resolution.

added 109 characters in body
Source Link
George Mauer
  • 122.9k
  • 140
  • 401
  • 632

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?

By the way I make sure I invoke this at the top of the page:

 jQuery.ajaxSettings.traditional = true

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?

By the way I make sure I invoke this at the top of the page:

 jQuery.ajaxSettings.traditional = true
Source Link
George Mauer
  • 122.9k
  • 140
  • 401
  • 632

Passing array parameters from jquery to ASP.NET MVC

Does anyone have any insight on what's going on here? Here is my clientside jquery 1.4.1 code:

$.ajax({
    type: "POST",
    url: "PrintBOL/Print",
    data: [1, 2, 3],
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    error: function(xmlHttpRequest, status, errorThrown) {
        console.debug(xmlHttpRequest)
    },
    success: function(serverReply) {
        console.debug("OK")
        console.debug(serverReply)
    }
})

Here is my server-side method signature:

public ActionResult Print(int[] ids)

The ids parameter always comes across as null.

Any ideas?