我有代码片段,在点击如下链接时执行
cj_redirecturl="/HomeWork/main/load_course";
utility.xhttprw.data(cj_redirecturl,{data:courseid},function(response){
if(response){
window.location.href=base_url+"main";
///next
utility.xhttprw.data(redirecturl,{data:""},function(response){
if(response){
id=ent;
document.getElementById('content').innerHTML=response;
// Assignemnt module
//Call function from javascript/assignment.js file to display particular assignment (ent:means assignment_id) //
if(con==5)
{
get_assignment_id(ent);
}
if(con==9)
{
get_content_details(ent);
}
} //end of response
},false,false,false,'POST','html',true);
}
},false,false,false,'POST','html');
在上面的代码中,window.location.href=base_url+"main";
将页面重定向到其各自的页面,但这会停止执行写在它旁边的代码。现在我希望这段代码在编写时执行,即首先代码应该将我带到相应的“主”页面,然后必须执行之后编写的代码并给我一个所需的输出。
有人可以指导我实现这一目标吗?