PHP and Javascript - Do I need ajax?
Posted: Sat Feb 24, 2007 1:58 am
feyd | Please use
I did try the following but it only wrote the functions output 'code' to the page.
Is this what 'ajax' is for?
tia, Will./
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hey Gang,
I need to use 'something' like the following code to add a row of select drop downs from a db. Is there a way to do this? I know JS is client side and PHP is server side so I know there is a limitation. Does anyone have an example or tutorial on how do to something like it.
[syntax="html"]
<SCRIPT LANGUAGE="JavaScript">
function addRow(id){
var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0];
var row = document.createElement("TR")
var td1 = document.createElement("TD")
td1.appendChild(document.createTextNode("column 1"))
var td2 = document.createElement("TD")
td2.appendChild (document.createTextNode("column 2"))
row.appendChild(td1);
row.appendChild(td2);
tbody.appendChild(row);
}
</script>
<BODY bgcolor=#009999>
<a href="javascript:addRow('myTable')">Add row</a>
<table id="myTable" cellspacing="0" border="1">
<tbody>
<tr>
<td>row1_column1</td><td>row1_column1</td>
</tr>
</tbody>
</table>
</body>
Code: Select all
td1.appendChild(document.createTextNode(\"".deliveryTypes()."\"))tia, Will./
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]