
Untitled
By: a guest on
Jun 20th, 2012 | syntax:
JavaScript | size: 1.15 KB | hits: 13 | expires: Never
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
function verify(infoid, status)
{
alert('iiii')
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert('ok')
}
}
xmlhttp.open("POST", "/verify/" + infoid, true);
xmlhttp.setRequestHeader("X-CSRFToken", getCookie('csrftoken'));
if (status == 1)
xmlhttp.send("Submit=1&redirect=0");
}