javascript - ajax doesnt pass variable to php script -


hi cant script work update script works fine doesnt seem pass variables update qty page

<script type='text/javascript'>  function updateqty() {     var str = $(this).attr('name');     var ordercode = str.slice(9, -1);    var quantity = $(this).value;     var xmlhttp = new xmlhttprequest();      xmlhttp.onreadystatechange = function()     {       xmlhttp.open("get","updateqty.php?id=" + ordercode + "&qty=" + quantity, true);       xmlhttp.send();    } }  </script>  <input type='text' name='quantity[701]' size='3' tabindex='1' onblur='updateqty(this)' /> 

you might want define xmlhttp. they're not reusable, after all.

 var xmlhttp = new xmlhttprequest(); 

this not cross-browser compliant fail on old ie. you're using jquery name selection - why don't make use of jquery.ajax?


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -