php - getting Select tag value by ajax -


<?php     include('connection.php');     $query="select * category";     $result=mysql_query($query,$conn);     echo'     <select name="category" id="uni" >';     //the select tag start here,it gets options database     while($catrow=mysql_fetch_array($result)) {         echo'<option value="">';         echo'<option  value="'.$catrow['id'].'">'.$catrow['name'].         '</option></form>';     }     echo'</select>'; ?><br /> 

now have ajax codes this,i know how input value ajax dont know how select tags value ajax.

i use line of code input types:

function checkuser() {      var str=document.form.category.value;      xmlhttp=getxmlhttpobject();      if (xmlhttp==null) {         alert ("browser not support http request");          return;     }      //this line inputs value,how can select tag's?????!!!     url='addserv.phptitle='+document.getelementbyid('title').value+document.getelementbyid('latitude').value+document.getelementbyid('ownerid').value;     //alert(url);      xmlhttp.onreadystatechange=statechanged;      xmlhttp.open("get",url,true);      xmlhttp.send(null); }  function statechanged() {      if (xmlhttp.readystate==4 ){          var name = xmlhttp.responsetext;     } } 

if php echoing correct markup , want append dom, can this:

$.ajax({     type: 'get',     url: 'something.php',     success: function(data) {         $('.someelement').html(data);     } }); 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -