我需要codeigniter ajax响应,请帮我做..请询问任何其他进一步的要求..
我在添加这种 Ajax 时得到空响应谢谢
function Ajax_newsletter()
{
var str=document.getElementById("sub_email").value;
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
}
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(xmlhttp.responseText);
if(xmlhttp.responseText==1)
{
document.getElementById("txtHint").innerHTML='User Already Exist..';
}
elseif(xmlhttp.responseText==0)
{
document.getElementById("txtHint").innerHTML='Newsletter subscribed..';
}
}
}
xmlhttp.open("GET","<?php echo base_url();?>index.php/ajax/checkuser/"+str,true);
xmlhttp.send();
}