Following is the simple ajax I was using in the projects:
jQuery.ajax({ url: "/controllerName/actionName", data: "testKey=" + testValue, success: function (data) { alert(data); } });
This works fine but if testValue contains ‘&’ then data received in the controller is not correct.
e.g. if
testValue = Hounour & Awards
then params are
[testValue: Hounour, Awards:, action: actionName, controller: controllerName]
I found a simple a way to solve the issue and best thing is no string concatenation required:
jQuery.ajax({ url: "/controllerName/actionName", data: {testKey: testValue}, success: function (data) { alert(data); } });
Recent Comments