[eluser]Grind[/eluser]
On a page, checking and unchecking a checkbox must be stored to the database via Ajax. Normally I achieve it like this:
Code:
[removed]
<!--
function rights(group_id, value, module)
{
var checked = (value) ? 1 : 0;
createXMLHttpRequest();
var params = "checked="+checked;
params += "&group;_id="+group_id;
params += "&module;="+module;
xmlHttp.open("POST", "/ajax/saverights.php", true);
xmlHttp.onreadystatechange = saveready;
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
}
function createXMLHttpRequest()
{
if (window.ActiveXObject)
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
}
function saveready()
{
if (xmlHttp.readyState == 4)
{
var response = xmlHttp.responseText;
alert(response);
}
}
//-->
[removed]
But now with CI I get a 404 when I try to access /ajax/saverights.php. How does CI handle Ajax requests? Is it possible for me to write everything by myself? Which URI should I refer to in the JS-code?
Thanks.