I just fiddled following script.
It’s not working.
<SCRIPT>
function kin() {
var kobj = document.getElementById("k"); // input Object
var q = kobj.value;
$.ajax({
type: "POST",
URL: "zips.php",
data:q,
success: function(res) {
$("#result").append(res);
console.log(res);
}
});
}
</SCRIPT>
<INPUT type="text" autocomplete="off" value="" id="k"><input type="submit" value="search" onClick="kin()" data-role="button">
<DIV id="result"></DIV>
I noticed two errors in the code you posted. I commented old code, so you can easily notice changes.
JQuery allows you to rewrite the code you posted like this: