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!!!
Use
escape(oEditor.GetXHTML()).