开发者

javascript to add source URL

开发者 https://www.devze.com 2023-04-03 04:37 出处:网络
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

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

精彩评论

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