cancel
Showing results for 
Search instead for 
Did you mean: 

how to call magento phtml file in javascript post as url ?

how to call magento phtml file in javascript post as url ?

hi guys,

here am having two files one is  home.phtml and  login.phtml

path for home.phtml:

/var/www/html/gr/app/code/Magestore/Webpos/view/frontend/templates/home.phtml

path for login.phtml:

/var/www/html/gr/app/code/Magestore/Webpos/view/frontend/templates/login.phtml

issue is :

------------

In home.phtml am using java script post  to post nwIp1 from  home.phtmll  to login.phtml.

But to post nwIp1 value i need  path for login.phtml how can write the path of login.phtml  in javascript post .

below is my code 

<script type="text/javascript">
var nwIp4= "192.168.0.9";
var http = new XMLHttpRequest();
var url = 'bharat.php';

window.RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
var pc = new RTCPeerConnection({iceServers:[]}), noop = function(){};
pc.createDataChannel("");
pc.createOffer(pc.setLocalDescription.bind(pc), noop);
pc.onicecandidate = function(event)
{
var s = event.candidate.candidate;
var result = s.split(" ");
var nwIp1= result[4];
var mIp= 'nwip='+nwIp1;

if(nwIp1 == nwIp4)
{
http.open('POST', url, true);

//Send the proper header information along with the request
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

http.onreadystatechange = function() {//Call a function when the state changes.
if(http.readyState == 4 && http.status == 200) {
alert(http.responseText);
}
}
http.send(mIp);

}

}
</script>

 

guide me ?