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

i have a problem with .htaccess and ajax :\

Postby mekha » Thu Aug 02, 2012 1:14 am

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

my ajax:
Syntax: [ Download ] [ Hide ]
<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:
Syntax: [ Download ] [ Hide ]
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.
mekha
Forum Contributor
 
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

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

Postby social_experiment » Thu Aug 02, 2012 1:48 am

mekha wrote:i have a problem with

could you perhaps elaborate on the problem that you are having? :)
First, solve the problem. Then, write the code.
“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
When asking for assistance give as much information about the problem as possible
User avatar
social_experiment
DevNet Master
 
Posts: 2688
Joined: Sun Feb 15, 2009 12:08 pm
Location: South Africa

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

Postby mekha » Thu Aug 02, 2012 1:53 am

hi man , i edited the thread :)
mekha
Forum Contributor
 
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

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

Postby social_experiment » Thu Aug 02, 2012 2:17 am

thank you for the edit but i was actually hoping for a explanation of what happens ;) is it an issue with redirecting?
First, solve the problem. Then, write the code.
“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
When asking for assistance give as much information about the problem as possible
User avatar
social_experiment
DevNet Master
 
Posts: 2688
Joined: Sun Feb 15, 2009 12:08 pm
Location: South Africa

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

Postby mekha » Thu Aug 02, 2012 2:28 am

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
mekha
Forum Contributor
 
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

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

Postby social_experiment » Thu Aug 02, 2012 2:51 am

if you comment out or remove the rule from the .htaccess file, what happens?
First, solve the problem. Then, write the code.
“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
When asking for assistance give as much information about the problem as possible
User avatar
social_experiment
DevNet Master
 
Posts: 2688
Joined: Sun Feb 15, 2009 12:08 pm
Location: South Africa

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

Postby mekha » Thu Aug 02, 2012 2:54 am

if i remove the rule from htaccess its work with no problems :\
mekha
Forum Contributor
 
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

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

Postby social_experiment » Thu Aug 02, 2012 3:29 am

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/5222677/htaccess-causes-problem-with-ajax
First, solve the problem. Then, write the code.
“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
When asking for assistance give as much information about the problem as possible
User avatar
social_experiment
DevNet Master
 
Posts: 2688
Joined: Sun Feb 15, 2009 12:08 pm
Location: South Africa

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

Postby mekha » Thu Aug 02, 2012 3:53 am

i tryed all of stackoverflow problems solutions..i didnt succeed... is there some one that can edit me the code above...please?
mekha
Forum Contributor
 
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am


Return to PHP - Code

Who is online

Users browsing this forum: Bing [Bot] and 9 guests