views:

36

answers:

1

i have an ajax call

$.ajax({
                url: '<%=Url.Action("SaveDetails","Survey") %>',
                dataType: 'JSON',
                cache: false,
                data: { Id: selectedRow.Id, Value: surveyValue, FileName: filename, FileGuid: fileguid },
                success: function(data) {
                    ...
                }
            });

where the surveyValue is a html string. this call doesn't work. but is i change the surveyValue to an ordinary text i works fine.

how can i pass the html to the server?

+4  A: 

I'm guessing you'll need to encode it:

data: { ... Value: encodeURIComponent(surveyValue), ... }

And on the server side:

string value = Server.UrlDecode(surveyValue);
Joel Potter
thanks for that, Joel
CoffeeCode