i have a problem with .htaccess and ajax :\

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

i have a problem with .htaccess and ajax :\

Post by mekha »

hi,i have a problem with .htaccess and ajax :\..

my ajax:

Code: Select all

<script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").style.visibility='hidden';
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
	document.getElementById("txtHint").style.visibility='visible';
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","rpc.php?q="+str,true);
xmlhttp.send();
}
</script>
...
and my htaccess:

Code: Select all

RewriteEngine On

RewriteRule ^page/(.*)$ page.php?num=$1
...
Can you help me please?
there are a conflict between the .htaccess and the ajax function!
Last edited by mekha on Thu Aug 02, 2012 1:48 am, edited 1 time in total.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: i have a problem with .htaccess and ajax :\

Post by social_experiment »

mekha wrote:i have a problem with
could you perhaps elaborate on the problem that you are having? :)
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

Re: i have a problem with .htaccess and ajax :\

Post by mekha »

hi man , i edited the thread :)
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: i have a problem with .htaccess and ajax :\

Post by social_experiment »

thank you for the edit but i was actually hoping for a explanation of what happens ;) is it an issue with redirecting?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

Re: i have a problem with .htaccess and ajax :\

Post by mekha »

no,not redirecting...its an box open under the search input that gets from the database string LIKE the value i write in the input....now....in the regular pages:xxxx.php?id... its work great
but in the htaccess
xxxxxx.com/xxxxx/someword
the box that opened doesnt give me the string from the database...but GIVE ME THE HOME PAGE IN THAT DIV :|....i mean: i have a <div>HERE THE RESULTS</div>...in stead of show me the string from the database...i get the home page in that div :|....just in the htaccess
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: i have a problem with .htaccess and ajax :\

Post by social_experiment »

if you comment out or remove the rule from the .htaccess file, what happens?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

Re: i have a problem with .htaccess and ajax :\

Post by mekha »

if i remove the rule from htaccess its work with no problems :\
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: i have a problem with .htaccess and ajax :\

Post by social_experiment »

This isn't exactly like the problem you are having but it might shed some light on what's causing it. hth
http://stackoverflow.com/questions/5222 ... -with-ajax
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

Re: i have a problem with .htaccess and ajax :\

Post by mekha »

i tryed all of stackoverflow problems solutions..i didnt succeed... is there some one that can edit me the code above...please?
Post Reply