Javascript, Ajax and form submission/response -


I hope that this is a simple solution, or its possible AJAX timeline!

I was using ClickBank on my page I had a simple button that sent the form data to a script, I processed the data, and then went to the "payment" link to end the script Added a redirect to. Good n 'easy

But now I'm switching to "Click2Sell" ... and there is a direct href on their site.

Now I can read the form using Javascript, place it in my "cp_" prefix, and create a super long (approximately 400 characters) query string and send it to my server, then the IPN Read the data again at the step ...

  country = UK and region = essex & amp; Desc = This user has data recorded by 'whatever'  

(But this is a little fact that some parts may be required

So I used this method Has been prepared:

  & lt; javascript & gt; function send_data () {document.user.submit (); back true;} & lt; / javascript & gt; & lt; Div name = "noshowdiv" & gt; Object name = "nohow">   
textarea name =" Desc " & Gt; & lt; / textarea & gt; & lt; / form & gt; & lt; a href = "click2sell.asp" & gt; & lt; img src = "xxx" onclick = "sending send_data (); "> In a nutshell, when the button is clicked, it jumps on the function, and submits the form to my script, and then submits the form through hyperlink via hyperlink. To come back.

Two problems: First of all, the data returned by my script & lt; Div & gt; Instead of opening in a new tab, (I suspect that 'Submitting the option loses the track of the window while sending the option) Also, I need to get a response from my script, which I can then link to the href link I am

For example, if the form records the user's data on line 5 on my server, then the script will return "id = 5" then I hyperlink "click2sell.asp? Cp_id = 5"

As I said, I suspect that this is a job for AJAX and HTPequest ... which is a new area for me, any problem?

For the first issue, a new tab opens because you have target = your form But "no-show" .

For the second problem, if you want to use Ajax, then I suggest that if you use jQuery, it will simplify a lot of code.

But the best option is that you completely remove click2sell directly, and just add a submit button to your form. Post the form on your site, which will store any information that is required, will specify the ID, and one of the parameters will create the click2sell URL with the ID, and redirect it.

How will you do now depends on the server-side language you use.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -