473,387 Members | 1,535 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,387 software developers and data experts.

not able to update the data thro ajax send

hi,
On a test page i try to insert some values thru post method but the values which i send is not replaced in the url which i specify. I get the code found in the page and not the updated one.

My Code

after creating the xmlhttp object

temp ="";

function ajxReq(){
url ="http://192.168.1.41/ajaxsend/login.php?unameTxt=" +document.getElementById('loginName').value+"&pwdT xt=" +document.getElementById('loginPassword').value;
xmlhttp.open("POST",url,true)
xmlhttp.onreadystatechange = loadPage;
xmlhttp.send(null)
}

function loadPage(){
// on status=200
document.getElementById("respdiv").innerHTML = xmlHttp.responseTEXT;
alert("The Div \t"+document.getElementById("respdiv").innerHTML );
// this gives the raw file not the updated one
}

function sendParam(){
temp = '"name="+document.getElementById(\'loginName\').va lue+"password="
+document.getElementById(\'loginPassword\').value' ;
ajxReq();
}
</script>
</head>
<table border="0" cellspacing="0" cellpadding="0" width="300">
<tr>
<td>User Name</td>
<td><input type="text" name="unameTxt" id="loginName" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="pwdTxt" id="loginPassword" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="button" value="Login" onclick="sendParam();"/></td>
</tr>
</table>
<div id="respdiv" style="border:1px dashed orange"></div>
</html>

i tried thru xmlHttp.send(temp) ............. giving the static url with parameters...

Nothig is working

php file
******

<?php
$uname = $_POST["unameTxt"];
$pwd = $_POST["pwdTxt"];
echo "User Name :".$uname."<br>Password :".$pwd;
?>


Looking for a reply to proceed further.

I have another doubt too. IF it is working fine with response text i dont have an idea of structure of the xml doc formed .... Looking for an comment on this too.
Jun 21 '07 #1
7 2034
hi,
finally i got it
set the request header content -type to
application/x-www-form-urlencoded
then send the string values in xmlhttp.send() in the same way as in get
Jun 22 '07 #2
hi,
finally i got it
set the request header content -type to
application/x-www-form-urlencoded
then send the string values in xmlhttp.send() in the same way as in get

but is there a way post a xml to update the file. Iknow it can be done then if its so.
do i need to parse the xml doc in the page where the data is received.

Looking for for a reply.

Thanks in advance for a reply.
Jun 22 '07 #3
acoder
16,027 Expert Mod 8TB
but is there a way post a xml to update the file. Iknow it can be done then if its so.
do i need to parse the xml doc in the page where the data is received.
Update the file where?
Jun 22 '07 #4
Update the file where?
I have an xml file in my server. I get an responseXML when the page is called. I manupulate the xml with DOM and change the values of some nodes. and send the xml to the same file.Now! If i get the access the page,responseXML the changes that i made are not effected.

What to do to replace the xml or replace the node in the server. I dont have any idea. How do i receive the data at the server as an xml itself OR in what format is the xml received. I set the RequestHeader as application/xml.

Looking Forward for a reply.
Jun 25 '07 #5
acoder
16,027 Expert Mod 8TB
See the last example in this page. The header is set as "text/xml" and the xml is sent as a string using the send method.
Jun 25 '07 #6
See the last example in this page. The header is set as "text/xml" and the xml is sent as a string using the send method.
Thanks but.. ,I know this but i have no idea of how to receive the xml in the server or the url specified. i.e receive the xml sent thru xmlhttp.send(xmlstr) and workaround with it in the server side file.

If the string is assigned to a variable then i can retrive the value of the vriable in _POST[] method in php but is there a way to get the strin as it is (like the link shown by you) and then play with the xml in the server side to update the file.

Thanks in advance
looking for a reply.
Jun 26 '07 #7
acoder
16,027 Expert Mod 8TB
That's a PHP question. Since this is different question to the original one, I suggest you start a new thread in the PHP forum for this.
Jun 26 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: kbs | last post by:
Hi all, i'm new here, and I just beggining with c# so.. I'm brazilian, and I already get connect to mysql using MySQLDriverCS, but I can't display data on a datagrid or thro an aspx file. can...
1
kudos
by: kudos | last post by:
Hi! Im kind of new to ajax (but actually an old timer when it comes to javascript). I have the following question. I have a webapplication that will be accessed from an ajax interface. However, I...
2
by: Marcus | last post by:
Here is a toy problem describing what I want to do: I have a web page with a single IMG element (say for a 128 x 128 "screen") which is initially blank (image=black pixels). I have AJAX code...
4
by: vunet.us | last post by:
Hi all, I am converting my app to AJAX-based. I have a form that submits some data including images. When I use AJAX XmlHttpRequest I am unable to submit the form with...
1
navneetkaur
by: navneetkaur | last post by:
some1 plz help me hw i insert values thro data adapter...m doing it using command builder bt it gives error,,if u have code...help me ...m waiting
2
by: ajaxcoder | last post by:
Hi In my project i had a login form and i am trying to send the username and password to the server for authentication using xmlHttpRequest. Hence i am using POST request but i am unable to send...
21
by: javelin | last post by:
I created a feature in a page where a DIV displays child records of the current record. From this same page, I can submit the insertion of a new child record. However, the while the previous child...
1
by: krishemanth | last post by:
sir, I want to update a value in dropdown using ajax i had a listing of some categories in dropdown along with that i had an add category in that dropdown box when select that addcategory option...
0
by: cmrhema | last post by:
Hi, We are receiving huge number of data thro sockets, which we write up in a Message Queue. Thereafter we take all the values from the Queue and write up into the database. However we notice...
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:
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...

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.