Jump to content
  • Advertisement
Sign in to follow this  
UltimaX

[web] Ajax Comma Issue

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone. I am having an issue that is driving me crazy. I am using PHPLiveX for Ajax and whenever I post/get a field that has a comma in it the data returns with anything after the comma missing. For example, if I have a business field and the user types in "CompanyABC, Inc." it will only send "CompanyABC". If you type something in the message area like "Hello, my name is James and I was inquiring about something this and something that." it will return simply "Hello". Has anyone ran into this issue or is it a problem with PHPLiveX? It almost seams like it's using comma's as delimiters for some reason. I would greatly appreciate any help. You can find PHPLiveX here. Thank You

Share this post


Link to post
Share on other sites
Advertisement
I'm not going to install the framework to test it, but my first guess is that you need to add quotes around the string. If there are no quotes, php will interpret the CompanyABC as a string folowed by a comma, and then another argument. (I think that is the behavior... I can't find that in the manual, but I recall it.)

Edit:
I don't know if this explains it, but read this:

If you use an undefined constant, PHP assumes that you mean the name of the constant itself, just as if you called it as a string (CONSTANT vs "CONSTANT").

From this page: http://www.php.net/manual/en/language.constants.php

Share this post


Link to post
Share on other sites
Found it!

In the callback function they have "var StringArgs = args.join();", which takes an array and makes into a comma delimited string (by default). Then when they parse that data they call "if(funcArgs.indexOf(",") != -1) args = funcArgs.split(",");", which would explain the problem. I simply changed it to "var StringArgs = args.join("~");" and "if(funcArgs.indexOf("~") != -1) args = funcArgs.split("~");". Now it works fine.

Thanks for the help, I appreciate it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!