English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a hard time to pass a form and its data from a javascript to PhP, in an AJAX environment.
The following JS function receives data from a php code:
function js_admin_users_update(theForm)
{
showform(theForm);
sajax_target_id = 'admindata';
x_p_admin_users_update(theForm);
sajax_target_id = '';
}
(Showform shows details ok)
function showform(theForm)
{
var txt = "Form name: " + theForm.name + "\r\n";
txt += "theForm.elements.length " + theForm.elements.length+"\r\n";
for (var i=0; i txt += theForm.elements[i].name + " = " +
theForm.elements[i].value + "\r\n";
alert(txt);
}
the function "p_admin_users_update(theForm)" MUST return a $txt that will be displayed, i.e.:
function p_admin_users_update($frm)
{
$txt = "admin_users_update()
";
return ($txt);
}
How do I get variables names and values from the object?

2007-08-26 06:56:34 · 3 answers · asked by just "JR" 7 in Computers & Internet Programming & Design

3 answers

It’s not clear from your question exactly what you’re trying to achieve, but I think what you may be after is a common transport language for dealing with data on both the JavaScript and PHP ends of the Ajax request.

I’d recommend you look into JSON [1][2], which has a syntax that will be familiar to you if you’ve used JavaScript, and is certainly easy to use with PHP [3].

I believe JSON support is built in to PHP 5.2 if you happen to be using that.


Best wishes,
Dave Cardwell.
http://davecardwell.co.uk/javascript/

2007-08-27 05:11:19 · answer #1 · answered by Dave Cardwell 3 · 1 1

opposite to the previous poster you are able to pass hidden values. i do no longer see the region you're posting to a sort reported as shop2.own abode web site in certainty supply me an e mail with the code correct and that i will make certain if i will allow you to to.

2016-10-17 01:07:25 · answer #2 · answered by ? 4 · 0 0

Uhm Uhm, I think I dont understand your problem, so Could you plz give me more info ?? about your problem ??
Thanks for reading my reply

2007-08-26 07:28:35 · answer #3 · answered by Indochina Travel 1 · 1 1

fedest.com, questions and answers