$. Extend ({
AjaxForm: function (action, formID, callback ){
Var form = $ ("#" + formID );
Form. attr ("action", action );
Form. attr ("method", "post ");
$ ("# Callbackmethod"). remove ();
Form. append ("<input id = 'callbackmethod' name = 'callbackmethod' type = 'did' value = '" + callback + "' \> ");
Var ajaxiframe = formID + "_ AjaxIFrame ";
Form. attr ("target", ajaxiframe );
Form. append ("<iframe name = '" + ajaxiframe + "'id ='" + ajaxiframe + "'style = 'display: none; '> </iframe> ");
Form. attr ("enctype", "multipart/form-data ");
Form. submit ();
},
ToJson: function (str ){
Return eval ('+ str + ')');
}
});
$. AjaxForm ('<% = Url. Content ("~ /Utility/PicUploadHander. ashx ") %> ', 'uploadform', function (str ){
Var json = eval ('+ str + ')');
Alert (json. Name );
Parent. Home (); // method on the Home page
});
Private void WriteForm (string str, HttpContext context)
{
String method = context. Request ["callbackmethod"];
String isJson = context. Request ["isJson"];
String hs = "<script> void" + method + "('" + str + "'); </script> ";
Context. Response. Write (hs );
Context. Response. Flush ();
Context. Response. Close ();
}