Sign in to follow this  

[web] Ajax Comma Issue

This topic is 3460 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
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

This topic is 3460 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this