开发者

javascript to add source URL

I am using the following code in CEWP (content editor webpart) so after taking a survey user will be redirected to thank you page. the redirecting is not working. Am I missing something? (user able to take survey and newform.aspx never closes)

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>  
<script type="text/javascript">  
 function PreSaveAction(){  
     var URL = location.pathname.replace("NewForm.aspx","/surveys/Pages/ThankYou.aspx");  
     if(GetUrlKeyValue("IsDlg")==="1"){  
         URL+="?IsDlg=1";  
     }  
     $("#aspnetForm").attr("action",loca开发者_高级运维tion.pathname+"?Source="+URL);  
     return true;  
 }  
</script> 


Where's the redirect? Have you tried using window.location(URL); ?


Means you are getting double "/" in URL like this :

/surveys/Lists/TestSurvey//surveys/Pages/ThankYou.aspx?IsDlg=1

just remove starting / from below string

 /surveys/Pages/ThankYou.aspx
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜