I started a new job, and part of the project that I am working on has a very strange structure. Each page is a .Net aspx page, and it loads just fine, but nothing happens during loading. Everything is really loaded from the jquery document.onready handler.
What's even more interesting ... is that the onready handler makes some ajax calls that drop entire .aspx pages into a div on the page, but first it cuts out several parts of the returned page. This is the "magic" script the previous programmer ran through all the returned html from his ajax calls:
function CleanupResponseText(responseText, uniqueName) {
responseText = responseText.replace("theForm.submit();", "SubmitSubForm(theForm, $(theForm).parent());");
responseText = responseText.replace(new RegExp("theForm", "g"), uniqueName);
responseText = responseText.replace(new RegExp("doPostBack", "g"), "doPostBack" + uniqueName);
return responseText;
}
Then it intercepts any form of postback and performs its own form submission function:
function SubmitSubForm(form, container) {
$(form).ajaxSubmit( {
url: $(form).attr("action"),
success: function(responseText) {
$(container).html(CleanupResponseText(responseText, form.id));
$("form", container).css("margin-top", "0").css("padding-top", "0");
}
}
);
}
, ? , html head , , div?
, , asp: gridview controls viewstate, , .
- ?