first create a controller in controller folder of your module
and insert this script in phtml file where you want get result.
<script>
function loadXMLDoc(cid)
{
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)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getallcustomer/ajax/index?a="+cid,true);
xmlhttp.send();
}
</script>
//"getallcustomer" :- is module name.
//"ajax":- is controller name (controller file name).
//"index":- is action of controller (function indexAction();)
<div id="myDiv">
ajax responce text print here.
</div>
and insert this script in phtml file where you want get result.
<script>
function loadXMLDoc(cid)
{
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)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getallcustomer/ajax/index?a="+cid,true);
xmlhttp.send();
}
</script>
//"getallcustomer" :- is module name.
//"ajax":- is controller name (controller file name).
//"index":- is action of controller (function indexAction();)
<div id="myDiv">
ajax responce text print here.
</div>
No comments:
Post a Comment