473,385 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

prototype.js ajax w/ post - how to send '+' character

Hi,

Firstly, I don't know if this is just and isolated thing with the
prototype.js library or
is a problem in general with ajax calls with a '+' character, so i am
posting it here.

I am trying to send input from a form to do a live php boolean
search. so an example
search string is
'+neoflex +standard +output -green'

the problem is something is filtering the '+' and i can figure out to to
send it.

here is the html and js that i am using.

<input type="text" id="prodid" onkeyup="autosearch(this)" name="prodid" />

function autosearch(element)
{ new Ajax.Request('ajax-search.php',
{ method: 'post',
postBody: element.name + '=' + escape(element.value),
onComplete: showResponse
});
return false;
}

ajax-search.php just echos (for testing right now)
$_POST['proddes']

'neoflex standard output -green'

This demo does the same thing if you enter something like '+jack' or
'jack+jill'
http://24ways.org/examples/easy-ajax-with-prototype/
http://24ways.org/advent/easy-ajax-with-prototype
any ideas?
Chuck
Mar 1 '06 #1
2 4623
Zif
chuck wrote:
Hi,

Firstly, I don't know if this is just and isolated thing with the
prototype.js library or
is a problem in general with ajax calls with a '+' character, so i am
posting it here.
The amount of help you'll get here for prototype.js is probably about
the same as that provided by its author's documentation. Search the
archives.

I am trying to send input from a form to do a live php boolean
search. so an example
search string is
'+neoflex +standard +output -green'

the problem is something is filtering the '+' and i can figure out to to
send it.

here is the html and js that i am using.

<input type="text" id="prodid" onkeyup="autosearch(this)" name="prodid" />

function autosearch(element)
{ new Ajax.Request('ajax-search.php',
{ method: 'post',
postBody: element.name + '=' + escape(element.value),


Use encodeURIComponent, not escape (see ECMAScript Spec Section 15.1.3).
It may not help...

[...]

--
Zif
Mar 1 '06 #2
Zif said the following on 3/1/2006 12:40 AM:
chuck wrote:
Hi,

Firstly, I don't know if this is just and isolated thing with the
prototype.js library or
is a problem in general with ajax calls with a '+' character, so i am
posting it here.


The amount of help you'll get here for prototype.js is probably about
the same as that provided by its author's documentation. Search the
archives.


I would endeavor to say that the help you will get for prototype.js is
better sought out from the author. It's not a very, umm, popular thing i
this group and the predominant opinion of it borders between junk and
"something VK might write".

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: NextOne | last post by:
Hi ! Is it possible to send an AJAX XMLHttpRequest using prototype.js API for a multipart/form-data ? I already done parsing form parameters and sending GET/POST request, but does this work...
45
by: bigdadro | last post by:
I've created a new class using prototype.js. After I make the ajax.request all references to this.myClassMethodorVariable are lost. Does the ajax method blow out the object persistance? I'm fairly...
5
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great...
31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
7
by: BeeRich | last post by:
Hi folks. I built an ajax.updater reply in a website on a Mac, and she works fine. It's a simple reply, the html supplied is correct, and I also supply the target DIV as well. Just wondering...
3
by: jacobstr | last post by:
I've noticed Object.extend used in a few different ways and I'm having trouble distinguishing why certain usages apply to a given situation. On line 804 Ajax.Base is defined as follows: ...
3
by: Tarik Monem | last post by:
Hi Everyone, Still a newbie with FLEX, and I've passed arrays using AJAX to FLEX before, but I've never passed links to FLEX. Basically, this is the OUTPUT, which I wanted, but I'm given an...
3
omerbutt
by: omerbutt | last post by:
hi there i have downloaded a prototype tooltip from http://www.nickstakenburg.com/projects/prototip/ the logic it uses is to call the script after creating the <div> for example i am using the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.