Welcome Guest, Not a member yet? Register   Sign In
Calling controller function from javascript
#1

[eluser]Shiju S S[/eluser]
I have a URL working in the browser but get 404 error when called from the javascript function

I have a javascript function:
var xmlHttp55;

//////////////////////////
function thalukcheck(id){
document.getElementById("branch")[removed]="<img src='images/loading.gif' width='10' height='10' > Loading.......";
xmlHttp55=GetXmlHttpObject()
if (xmlHttp55==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="addfields/thaluk";
url=url+"/"+id;
//url=url+"&sid;="+Math.random();
alert (url);
xmlHttp55.onreadystatechange=stateChangedEff;
xmlHttp55.open("GET",url,true);
xmlHttp55.send(null);
}
function stateChangedEff()
{
if (xmlHttp55.readyState==4)
document.getElementById("branch")[removed]=xmlHttp55.responseText;
}
///////////////////
function GetXmlHttpObject()
{
var xmlHttp55=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp55=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp55=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp55=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp55;
}

The controller function is located in the localsite:
quickbharath/addfieldsdir/addfields/thaluk
addfields is the controller php
thaluk is the function accepting one parameter


The is the route
$route['addfields/thaluk/(:any)'] = "addfieldsdir/addfields/thaluk/$1";



Messages In This Thread
Calling controller function from javascript - by El Forum - 01-29-2012, 11:00 AM
Calling controller function from javascript - by El Forum - 01-29-2012, 12:14 PM
Calling controller function from javascript - by El Forum - 01-29-2012, 11:18 PM
Calling controller function from javascript - by El Forum - 01-30-2012, 06:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB