Created
February 15, 2014 04:40
-
-
Save nirleka/9014658 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showPopUpDataPindah(button_id) { | |
var id_nik = button_id.substr(6); | |
console.log('id_nik: '+id_nik); | |
var nik = document.getElementById(id_nik).innerHTML; | |
console.log('nik: '+nik); | |
var id = button_id.substr(6); | |
var id_permohonan = document.getElementById(id).getAttribute('name'); | |
console.log('id_permohonan: '+id_permohonan); | |
var div = document.createElement('div'); | |
div.setAttribute('id', 'containerPopUp'); | |
var div2 = document.createElement('div'); | |
div2.setAttribute('id', 'popUp'); | |
div.appendChild(div2); | |
document.body.appendChild(div); | |
var xmlhttp; | |
if (window.XMLHttpRequest) { | |
// code for IE7+, Firefox, Chrome, Opera, Safari | |
xmlhttp = new XMLHttpRequest(); | |
} else { | |
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
} | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { | |
document.getElementById("popUp").innerHTML = xmlhttp.responseText; | |
var btn2 = document.createElement('button'); | |
btn2.setAttribute('onclick', 'this.parentNode.parentNode.removeChild(this.parentNode)'); | |
btn2.innerHTML = 'Close'; | |
btn2.setAttribute('class', 'btn'); | |
div.appendChild(btn2); | |
} | |
}; | |
xmlhttp.open('POST', "../process/showDataPindah.php", true); | |
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); | |
var param = 'nik=' + nik + '&id_permohonan=' + id_permohonan; | |
console.log('parameter yang dikirim: '+param); | |
xmlhttp.send(param); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment