Ajax post more than one data

Hello all,

I have a problem that i can not figure out!



            jQuery.ajax
            ({
               type: "POST",
               url: "mycheck.php",
               data: ({ slvalue: slvalue, lala: lal }),  
               cache: false,
                   ....
 If lal = number it post everything ok but if lal = text string does not!!!! Why?

Thanks in advance!
LVL 9
AlexSoftware EngineerAsked:
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.

hieloCommented:
put the values in quotes:

  data: ({ slvalue: "slvalue", lala: "lal" }),  
hieloCommented:
also, get rid of the parentheses, they are not needed:
data: { slvalue: "slvalue", lala: "lal" },
CodedKSenior Software EngineerCommented:
So if you set lal=120 and slvalue=140 it works ok?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

AlexSoftware EngineerAuthor Commented:
Hello Hielo,

This doesn't work.Maybe i have to give more informations.

slvalue is a numeric value of an input type.
lala is a text value of a div.
So before i post anything i set the vars and they filled in with the right data.

If i set by hand some values for example
data: { slvalue: 32323, lala: 2323 }, it works but if i set to post the vars doesn't work
hieloCommented:
>>slvalue is a numeric value of an input type.
>>lala is a text value of a div.
are encoding those values? For example, if you have
<div id='content'>Hello World</div>

and you want to assign Hello World to 'lala', then you need to:
{lala: encodeURIComponent(document.getElementById('content').innerHTML) }
CodedKSenior Software EngineerCommented:
Try to check your php file. There is probably a the quotes you are using to "collect" your posted vars are not right.

Use double quotes.

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
AlexSoftware EngineerAuthor Commented:
Yes Codedk that was exactly the problem!
The js was right but the problem was into the php file.I place the post var into quotes and now everything it's ok!
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
JScript

From novice to tech pro — start learning today.