Wednesday 23 October 2013

How to use ajax so that item name from database get displayed automatically for each item no

Posted by Саша 15:37, under | No comments


How to use ajax so that item name from database get displayed automatically for each item no..? How to use ajax so that item name from database get displayed automatically for each item no..?

<script>
function showUser(str){
if (str==""){

document.getElementById("txtHint").inner...
return;
}

if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}

else{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").inner...
}
}
xmlhttp.open("GET","listajx.php?q="+str,...
xmlhttp.send();
}
</script>
<script>

function add_col()
{

var num_box = document.getElementById("num_text").valu...
if(num_box)
{
for(var i=0;i < num_box; i++)
{

var tableName1 = document.getElementById("uTable");

var newTR1 = document.getElementById("td1");

var newName1 = document.createElement("TR");

newName1.innerHTML = " < input type='text' name='reqitem[]' id='item' onkeyup='showUser(this.value)' > ";

var newTR2 = document.getElementById("td2");

var newquantity1 = document.createElement("TR");

newquantity1.innerHTML = " < input type='text' name='reqquantity[]' id='quantity' > ";

var newTR3 = document.getElementById("td3");

var newmrp1 = document.createElement("TR");

newmrp1.innerHTML = " < input type='text' name='reqmrp[]' id='mrp' > ";

var newTR4 = document.getElementById("td4");

var newname1 = document.createElement("TR");

newname1.innerHTML = " < div id='txtHint'>x</div > ";

newTR1.appendChild(newName1);
newTR2.appendChild(newquantity1);
newTR3.appendChild(newmrp1);
newTR4.appendChild(newname1)
tableName1.appendChild(newTR1);
tableName1.appendChild(newTR2);
tableName1.appendChild(newTR3);
tableName1.appendChild(newTR4);


}

}

}
here shocol will automatically display the input boxes in a row and no. of rows will be decided by the user. I want showuser function to display the item name in each row corresponding to the item no. in that row.














0 коммент.:

Post a Comment