Log in

View Full Version : form problem using POST with AJAX



sfchun
10-30-2008, 04:58 PM
Hello,

Here is the situation :

I have a simple web page using css.
in a DIV i created a simple form (user and passwd) using POST method.

the form post line looks as follow,

<form method="POST" action="javascript:ajax_loadContent('divContainer','treatment.php');">

The action taken is then to load the result of a php page in the same DIV using AJAX (ajax-dynamic-content.js).

the problem :
The php script did not recieve any posted variable from the main page.
the following gives nothing : $passwd=(trim($_POST['passwd']));
variable is empty.


Any idea is welcome ^^;

rangana
10-31-2008, 01:35 AM
Show us the element having name of passwd. How is it laid on your form?

sfchun
10-31-2008, 12:23 PM
thanks for answering , it looks like this :

...
Enter your password : <input type="password" size="8" maxlength="8" name="passwd" value="" /> (8 caracteres maximum)
<input type="submit" value="Go" />

rangana
11-01-2008, 01:05 AM
Could you provide a link to where you got the script from DD.

sfchun
11-01-2008, 04:46 AM
K there is a long time i have this js code, and i doubt finaly to have found it on Dynamic Drive ... the one from Dynamic is a diferent...

anyway here is a direct link the the js file i'm using : Ajax dynamic content (http://www.koders.com/javascript/fidC23826CAA0C1729B4976267B88EF1F574254DB5D.aspx?s=ajax)

rangana
11-03-2008, 08:06 AM
The script you've shown shows error on sack() object.

Alternatively, you might find DD's script useful:
http://dynamicdrive.com/dynamicindex17/index.html

Bulevardi
12-02-2008, 10:09 AM
Tried the same sorth of thing here:

http://www.dynamicdrive.com/forums/showthread.php?p=173047#post173047

Seems no one has a solution?