0

I'm using this to save some data to DB:

$("#btnSave").click(function () {
    $.ajax({
        type: 'POST',
        contentType: "application/x-www-form-urlencoded; charset=UTF-8",
        data: 'description=' + oEditor.GetXHTML(),
        url: '/SuperAdmin/ReceiveData/',
        success: function () {
            alert('news saved');
        }
    });
});

"oEditor.GetXHTML" is taken from FCKEditor. And, to receive this data I have a ASP.NET MVC method (ActionResult):

public void ReceiveData(string description)
{
}

The point is: when I send, for example, this sentence include the "JavaScript Integration Module" scripts, the ReceiveData method only gets until include the ... what comes after that doesn't come.

Debugging my jQuery function above, I saw that the sentence that I'm trying to pass to the method has HTML encoding with &, amp; and so on. And the double quotes of the ..."JavaScript Integration Module"... is being interpreted by the ReceiveData method as a parameter, because the double quotes have the '&' in it encoding.

So, how can I transform this '& quote' to " before send to the MVC method? Or is there a way to make this method recognize this '& quote' as a character and not a parameter?

Thanks!!!

1 Answer 1

4

Use escape(oEditor.GetXHTML()).

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.