forum

Home / DeveloperSection / Forums / Html with json mvc

Html with json mvc

Anonymous User195529-Oct-2014

I need to pass html as parameter using json asp.net mvc2

I am trying to do like this:

$.ajax({
        type: "POST",
        dataType: "json",
        contentType: 'application/json; charset=utf-8',
        url: "/DefaultView/GeneratePDF",
        data: { "pdf": JSON.parse($("#displayContainer").html()) },
        success: function (data) {
            //nothing here
        }
    });

but it throws the "Uncaught SyntaxError: Unexpected token < " error.

using stringify() I am getting null here:

[HttpPost]
    [ValidateInput(false)]
    publicvirtualActionResult GeneratePDF(string pdf)
    {
        pdf <---
    }


Updated on 29-Oct-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By