ma201dq — 2011-06-09T09:46:52-04:00 — #1
in my html page within the head tags I have below js.
document.write('<img src="http://www.foo.com?Email='+Email1+'&Address 1='+A11+'&Address 2='+A21+'&Birthdate='+DOB1+'&City='+CI1+'&First Name='+FirstName1+'&Gender1='+Gender+'&Last Name='+LastName1+'&Phone Number='+PH1+'&State='+ST1+'&Zip Code='+ZIP1+'" width="1" height="1">');
setTimeout("location.href = 'http://www.foo.com?rid=" + (rid+FirstName+LastName+Email+Gender+DOB) + "&r="+(vRURL+A1+A2+CI+ST+ZIP+PH)+" ';",1500);
when I run the above in IE it redirects to whatever I have set in the setTimeout function, but on mozz it does not redirect. Mozz just get's stuck with the document.write in transferring data from foo.com back to me, but i only want it to do a document.write then move to setTimeout function.
I have struggling to get this working. anyone any ideas please?
cyberalien — 2011-06-09T12:23:59-04:00 — #2
Try using encodeURIComponent() on URL parameters. Like this: ...?Email='+encodeURIComponent(Email1)+'&Addr...
Also add / before ? to make a valid URL (though I'm not sure about this).
ma201dq — 2011-06-09T13:23:55-04:00 — #3
Dude thanks for your reply. That though wont solve it. The issue is such that on mozz it does the document.write, but it hangs and does not move on to setTimeout.
paul_wilkins — 2011-06-09T18:43:28-04:00 — #4
Is it even valid for an image to be written to the head?
ma201dq — 2011-06-10T04:30:38-04:00 — #5
I have had this solved now.
paul_wilkins — 2011-06-10T04:46:45-04:00 — #6
A typical way is for you to use a redirect page. That way, the redirect page performs the update that you require, and you can pass to that redirect page the name of the page that you want to redirect to, which can contain querystring info encoded within it as well.
ma201dq — 2011-06-10T05:05:54-04:00 — #7
Are you speaking of pushing the data to a popup window?
paul_wilkins — 2011-06-10T05:20:56-04:00 — #8
No, I'm speaking of using server-side code to do your action and to then perform the redirect for you.
If you don't want to go that far, you can just make use use of an ajax request of the first location, before loading the second page.
ma201dq — 2011-06-10T05:47:41-04:00 — #9
had I had access to the server side code this would been bread and butter to do, but I don't; I only have access to the client-side of things.
would you please care to show me how it is done using Ajax? I have been looking at an Ajax solution but could not get it to work.
paul_wilkins — 2011-06-10T05:53:49-04:00 — #10
Sure, the [Bulletproof Ajax book has good [url="http://bulletproofajax.com/code/"]code and examples](http://bulletproofajax.com/) to go along with the book's content.