javascript - with ajax js, passing an array to php -


i've created string array: 'id=$id&value=$value' 2 value id+checked, i'm trying pass array through php update db.. i'm newbie ajax don't know how correctly.. did inserting data form when works cool.. struggle badly issue. collect values table after click submit btn, please, out!

js code:

function ejecutarajax(datos) {     ajax = objetoajax();     ajax.onreadystatechange = enviardatos;     ajax.open("post", "trst.php");     ajax.setrequestheader("content-type", "application/x-www-form-urlencoded");     ajax.send(datos); }   var datos = new array,      querystring = '',      id = new array(),      status = new array(), checkstatus = document.getelementsbyname('check');  (i = 0; < checkstatus.length; i++) {     id[i] = checkstatus[i].getattribute('data-id');     status[i] = checkstatus[i].checked;     datos += "idstatus=" + id[i] + "&checkstatus=" + status[i] + "&"; } querystring = datos + "transaccion=upset"; //console.log(querystring); ejecutarajax(querystring); 

php code:

$idstatus = $_post["idstatus"]; $checkstatus = $_post["check"];  updatetable($idstatus,$checkstatus); 


Comments

Popular posts from this blog

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -

apache - setting document root in antoher partition on ubuntu -

python - pip install -U PySide error -