hi, im actually working on a project with Codeigniter and ajax. haha im sorry i posted a thread here. have been using phpbuilder for sometime.
My program allows user to submit description, URL of a picture to mysql database through ajax.
well the problem is, codeigniter allows only defined permitted URI characters to be passed as parameters. currently the characters that are allowed are "a-z 0-9~%.:_-". therefore, if i were to submit string like "hello world??", it will prompt a error message, "the URL submitted is not allow". if I were to allow all characters, there will be security breach. therefore i decided to encrypt the data into alpha numeric before passing into ajax engine. once is passed throught the ajax engine to the php code, i thought i could decrypt it to normal text with the javascript function. but the problem now is i cannot call the javascript decrypt function in php code.
hope you understand my complicated problem. =) below is my ajax and html code. appreciate if you could help me?
ajax engine
var xmlHttp
function ajaxpost(siteurl,param,tag)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
alert ("Browser does not support HTTP Request");
return;
}
var strurl=siteurl;
strurl=strurl+"/"+param;
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
document.getElementById(tag)[removed]=xmlHttp.responseText;
}
}
xmlHttp.open("GET",strurl,true);
xmlHttp.send(null);
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e){
// Internet Explorer
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e){
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
html:
<div><input type="submit" value="submit" onclick=ajaxpost(’controller/function’,’hello world???://’,’display’)><div>
<div id="display"></div>