I have a jQuery.ajax call on a button click event in my webpage. This ajax call sends quite a lot of markup back to the server. After some processing the server posts back a small URL address. This works fine sometimes but other times doesn't. I have a breakpoint just before the ajax call and also have some in my WebMethod. It appears that sometimes the WebMethod doesn't even get hit.
What could be causing the .ajax call to fail? I'm assuming there must be something in the parameters I am sending. But I am escape
ing the markup.
Anyone got any ideas?
$.ajax({
type: 'POST',
url: 'WebServices.asmx/GetBitmapPathForVML',
contentType: 'application/json; charset=utf-8',
data: '{"sVML" : "' + escape($('#divChart')[0].innerHTML) +
'","width" : 800,"height": 600}',
dataType: 'json',
success: function(result) {
var newWindow = window.open ("", "Chart","");
//blah blah
newWindow.document.write("<BODY>");
newWindow.document.write(
'<img src="file" alt="Chart"></img>'.replace('file',result.d)
);
newWindow.document.write("</BODY>");
//blah blah
}
});