Jump to content

Posting forms to Ajax script


gerkintrigg

Recommended Posts

Hello.

 

I think I have worked out where my problem lies, but have no clue how to fix it.

 

I'm posting the first name, surname and email to a newsletter signup script I found online. The original script only used the email address, but I wanted to make it a little more dynamic (a bit like aweber in that it can accept [fname] and replace it with the name from the database). Everything works except actually inserting the fname and sname variables into the database. (I was testing it using the SQL back end, originally).

 

I have tracked the issue to a Javascript snippet which originally said this:

 

data: 'email=' + $('#email').val(), // data to post

 

Thinking logically (or not), i changed it to this:

data: 'email=' + $('#email').val()+
	'fname=' + $('#fname').val()+
	'sname=' + $('#sname').val(), // data to post

 

This was initially just to prove to myself that the data is there and being passed to the script... it is, but it currently outputs like this:

 

email@email.comfname=firstnamesname=surname

 

Could someone please let me know what I'm doing wrong. I'm fine with PHP, but to say that I "muddle through" the javascript aspect is probably about right.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.