Welcome Guest, Not a member yet? Register   Sign In
how to mention uri in ajax java script
#1

[eluser]max123[/eluser]
there is a javascript file when using ajax. we have to mention the url of the handling php page in the javascript file. But in CI we have to mention the handling controler. Haw can I mention the url of the handling controler

var url="getuser.php";
url=url+"?q="+str;


for an example here data is submited to getuser.php . How can I mention a controler. It gives error when i mention it as
home/handle_controler

Please help me
#2

[eluser]Twisted1919[/eluser]
Use jquery and make an ajax call :
Code:
$.ajax({
url : '<?php echo site_url('controller/method/process');?>',
type:'post',
data:'url='+url+'&q='+str ,
success:function(msg)
   {
    alert(msg);
   }
});
This would be the most right solution , using jquery as it's a mature javascript framework , very used and cross browser compatible .
#3

[eluser]max123[/eluser]
thanx Twisted1919




Theme © iAndrew 2016 - Forum software by © MyBB