POst and redirect from javascript

Posted by Suju_jm under ASP.NET AJAX on 9/10/2009 | Views : 3605 | Status : [Member] | Replies : 3
I am using following code to post the data from pop up to the another page.
I want to redirect the parent page to the another page(assignkit.aspx) and close the pop up page.

var xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
xmlHTTP.open("POST", "AssignKit.aspx", false);
xmlHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
xmlHTTP.send(QStr);


Thank you in advanced.




Responses

Posted by: Lakhangarg on: 9/10/2009 [Member] [Moderator] Silver

Up
0
Down
MyXmlHttp=(window.XMLHttpRequest)?(new XMLHttpRequest()):(new ActiveXObject("Microsoft.XMLHTTP"));
MyXmlHttp.onreadystatechange=CallTeacherProfilebyXmlHttp_Callback;
var param='';
//POST method
MyXmlHttp.open ('POST',"abc.aspx",true);
MyXmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
MyXmlHttp.setRequestHeader("Content-length",param.length);
MyXmlHttp.send(param);

Thanks & regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com

Suju_jm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Suju_jm on: 9/10/2009 [Member] Starter

Up
0
Down
where is the redirection of the parent page code in this


Suju_jm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 9/10/2009 [Member] [MVP] Bronze

Up
0
Down
in the example you should define a function called
function CallTeacherProfilebyXmlHttp_Callback()
{
window.location = "/yourDestination.aspx";
}

Suju_jm, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response