Doug Bjerke
Doug Bjerke

Reputation: 9

The meaning of the ampersand

In this line:

var dataString = 'name='+ name + '&email=' + email + '&subject=' + subject + '&msg=' + msg;

What does the ampersand(&) mean?

Upvotes: 0

Views: 1182

Answers (1)

codingbiz
codingbiz

Reputation: 26376

I think the ampersands are meant for query string separation from each other

var dataString = 'name='+ name + '&email=' + email + '&subject=' + subject + '&msg=' + msg;

becomes

var dataString = 'name=John Doe&[email protected]&subject=some email subject&msg=hey activate your account';

This can then be appended to your Url

var finalUrl = "http://mysite.com?" + dataString;

Upvotes: 2

Related Questions