ak1dnar 1,584
Recognized Expert Top Contributor
When I am sending a form Input like in this format using ajax to my ASP.Net page;
term=ASP & PHP
Using This JavaScript; -
function myFunc(term_from_form){
-
var qstring = "term="+term_from_form; // ASP & PHP
-
url = 'ServerPage.aspx';
-
setParams(url,qstring)
-
}
-
function setParams(url,params){
-
makeobj(); // Creating http_request here
-
http_request.onreadystatechange = buildOutPut;
-
http_request.open('POST', url, true);
-
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-
http_request.setRequestHeader("Content-length", params.length);
-
http_request.setRequestHeader("Connection", "close");
-
http_request.send(params);
-
}
Only "ASP" part is getting,"& PHP" part is missing. - Dim SearchTerm As String = Request.Form("term")
the remaining part of the string is missing.(after the "&")
How to fix this? Thanks.
3 1675 Plater 7,872
Recognized Expert Expert
params are sent in the format of:
key1=value1&key 2=value2
So by straight using the the & you make it think that the "PHP" part is a new "key".
Try calling the escape() function onr your string first.
ak1dnar 1,584
Recognized Expert Top Contributor
params are sent in the format of:
key1=value1&key 2=value2
So by straight using the the & you make it think that the "PHP" part is a new "key".
Try calling the escape() function onr your string first.
-
function setParams(url,params){
-
makeobj();
-
alert(params) //term=ABC & DEF&area=London
-
var encodedInputString =escape(params);
-
alert(encodedInputString) //term%3DABC%20%26%20DEF%26area%3DLondon
-
http_request.onreadystatechange = buildOutPut;
-
http_request.open('POST', url, true);
-
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
-
http_request.setRequestHeader("Content-length", encodedInputString.length);
-
http_request.setRequestHeader("Connection", "close");
-
http_request.send(encodedInputString);
-
}
-
I tried that also. but see my sample Input String here. For that String the server side response is like this. -
Dim SearchTerm As String = Request.Form("term") ' Nothing
-
Dim area As String = Request.Form("area") ' Nothing
-
Is that mean ASP.net is not reading this line ?
//term%3DABC%20%2 6%20DEF%26area% 3DLondon
Plater 7,872
Recognized Expert Expert
Hmm I guess it is escaping TOO much, as it escapes the = signs and stuff too.
Try calling escape() on just parts
so like "key="+escape(v alue)+"&key2="+ escape(value2) (etc..)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've reduced my form request to a simple text string
entry, instead of my desired optional parameters. As i have been stuck
with a single unfathomable glitch for over a year.
Basically, if i enter queries such as ;
"select * from table" "select * from...
|
by: DC Gringo |
last post by:
I have an image control (that pulls an image off an ESRI map server):
<ASP:IMAGE ID="imgZonedCountry" RUNAT="server"></ASP:IMAGE>
In the code behind I am setting the ImageURL to a String value with url
parameters like this:
imgZonedCountry.ImageUrl =
"http://server/servlet/com.esri.wms.Esrimap?param1=x¶m2=y
When it serves up the page, I'm getting "&" in place of the "&"
|
by: Eric Osman |
last post by:
Hi,
I'm looking for a javascript function that will convert input such as this:
<CLUB Code="
into this:
<CLUB Code="
|
by: barney |
last post by:
Hello,
I' m using .NET System.Xml.XmlDOcument.
When I do the following:
XmlDocument xml = new XmlDocument();
xml.Load("blah");
....
xml.Save("blub");
I've got the problem that the following expression:
.... snip ...
|
by: martin |
last post by:
Hi,
I would be extremly grateful for some help on producing an xml fragemt.
The fragment that I wish to produce should look like this
<Addresses>
<Address>&qout;Somebody's Name" <me@mydomain.com></Address>
</Addresses>
| |
by: divya |
last post by:
Hi,
I have a table tblbwday with 2 fields Name and Birthday.I have written
this script for displaying evryday names of the people on that day.
<%
set objConn =server.createobject("ADODB.connection")
objConn.open "DSN=Photo"
Dim sqlSELsite,ObjRSSel
sqlSELsite = "SELECT Name FROM tblbwday WHERE B'day ="& date() &" " '
|
by: Me |
last post by:
I am passing on the input name to my asp page using
Response.redirect "mypage.asp?name=" & name
and the resulting url looks like
'companyname/mypage.asp?name=" & name
I would like it to appear like 'companyname' or at most
'companyname/mypage.asp'
how can I do it?
|
by: Ragnar |
last post by:
Hi,
2 issues left with my tidy-work:
1) Tidy transforms a "&" in the source-xml into a "&" in the tidied
version. My XML-Importer cannot handle it
2) in a long <title>-string a wrap is produced like:
<title>my very long title blab la blab la
Blabla bla </title>
Importer also has got problems with it
|
by: Medvedev |
last post by:
i see serveral source codes , and i found they almost only use "new"
and "delete" keywords to make they object.
Why should i do that , and as i know the object is going to be destroy
by itself at the end of the app
for example:
class test
{
public:
int x;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |