concatenating JavaScript strings

url: '/Administration/GetRoleList?name=&jtStartIndex=0d&jtPageSize=500&jtSorting=""',

Open in new window

I am trying to send empty strings.  

I get so confused with string concatenation in JavaScript when I am trying to build a string programMatically!!

I could use some help and some advice on how to keep straight when to use '  vs " and when to use "+" etc....
Tom KnowltonWeb developerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dsackerContract ERP Admin/ConsultantCommented:
In Javascript you concatenate with a "+".

You can enclose literal strings in either ' or ". Whichever one you start with, you must end with. That's why if you are going to have double-quotes within your string, it's best to start and end it with single quotes.

But you can use the + sign to concatenate them all, regardless of how you quote (or double-quote) them.
Tom KnowltonWeb developerAuthor Commented:
Can you give me a few examples?
dsackerContract ERP Admin/ConsultantCommented:
var x = "This is string one. It's got a single quote in it.";
var y = 'This is string two. It "shows" double quotes in it.';
var z = x + " " + z;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tom KnowltonWeb developerAuthor Commented:

So if I am trying to achieve this result:

 XHR finished loading: POST "http://localhost:40704/Administration/GetRoleList?name=&jtStartIndex=0&jtPageSize=50&jtSorting=Name%20ASC".

Open in new window

How would I do this?



the way you pass a null parameter (or empty string) ?
dsackerContract ERP Admin/ConsultantCommented:
A few questions, in order to answer yours:

This string you gave:

Does any of it already exist in a javascript variable?
Do you want to show it as an alert (pop up), or on your webpage, or where?
Tom KnowltonWeb developerAuthor Commented:

I think I got it now....

Thank you for your time!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.