Question

I am embedding a survey monkey survey onto my page and I want to detect when the user submits the survey and is routed to the "thank you" page. (At this point I want to redirect to another page, lets just say www.google.com for simplicity sake). How do I detect a change within the div to the survey monkey confirmation url? (Which seems to be: http://www.surveymonkey.com/Home_Landing.aspx?sm=HO4sAuxWGVqYlHQe3fZmKuIQKB2Chu5Pcw9UfeB2rP5FLvW8Xg8B7nyhEj9ZH1Fe)

Here is the survey monkey embedded info they have me add:

    <div id="surveyMonkeyInfo">
<div><script src="http://www.surveymonkey.com/jsEmbed.aspx?sm=vWWHOiYv9Mb1LAjgBfpOEw_3d_3d"> </script>
</div></div>
Était-ce utile?

La solution

SurveyMonkey has the ability to basically provide a callback site.

http://help.surveymonkey.com/articles/en_US/kb/Can-I-redirect-respondents-to-a-different-website-upon-completion

Another option using jquery to check the iframe for contents that indicated a completed survey. This will not work by directly linking to the survey through the iframe because you would then being attempting to access data across different domains.

$().ready(function(){
if($('#surveyFrameId').contents().find("div .embed_title").val() == 'Thank you for taking the survey!'){
    // do something
}

setTimeout(arguments.callee, 10000);})

You could something as indicated in the post below to get around the cross-domain issues.

Unsafe JavaScript attempt to access frame with URL

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top