When I ajaxSubmit a form, the service returns a number. For some reason, ajaxSubmit seems to add a bunch of tags to it.
form.ajaxSubmit(function(data){
alert(data);
});
});
Here, the alert prints out: "<head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">130</pre></body>"
Whereas if I check in my debugger, the value is simply 130.


I have made the assumption that since the service seems to return a correct value, this issue is caused only on the clientside. Please correct me if I’m wrong.
Why is the value different in the javascript from that in the response?
The problem was that jquery.form doesn’t expect to receive plaintext, it expects either JSON, XML, HTML or Script.
So I solved this by sending JSON-data from the serverside, and specifying that JSON was the expected format at the clientside.