Null Pointer
Null Pointer

Reputation: 9309

Ajax Post is failing if post data contains formatted string

How can i post formated strings like

 &nbsp;has<STRONG>b</STRONG>

I need to send ajax request .In my page i am using an editor , so that user can type and format. BUt ajax request failing if the string is formatted( eg: if the string have bold string .example data is shown above

 var test=$('#callTranscription').val(); // contains  &nbsp;has<STRONG>b</STRONG>
   var postData = { transID: $('#callTransactionID').val(), callTranscription: test, recordID: $('#selectedRecord').val() };
        $.ajax({
            type: "POST",
            data: postData,
            url: '<%= Url.Action("SaveCallTranscription", "Search") %>',
            success: function (result) {
                $('#callTransactionID').val(result)
                alert('success');
            },
            error: function (result) { alert('error'); }
        });

)

Here the callTranscription contains formatted string. How can i post is safely?Is there any conersion i need to do before sending that type if data.??

Upvotes: 0

Views: 879

Answers (1)

Thorben
Thorben

Reputation: 6991

You should format the string properly. Is it already formatted or are you sending raw data? Think of URLencoding http://www.javascripter.net/faq/escape.htm

Upvotes: 1

Related Questions