Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
create dynamic url for the navigate buttons

 
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
kam
New one
New one


Joined: 27 Oct 2007
Posts: 2

PostPosted: Sat Oct 27, 2007 8:11 am    Post subject: create dynamic url for the navigate buttons Reply with quote

Hi,

I am struggling for creating dynamic url for the navigates buttons, it is same as this
forum's navigate buttons (< 1 2 3 >).

i got a list buttons which are button 1 ,button 2 and button2.
when i click one of the buttons, i want to have a url with "www.mypage.com/javascript/1"
or "www.mypage.com/php/2".

the prblem i have, is that
when i do the second click on one of buttons, the browser give me the following url, and bring a 404 error massage.

http://www.mywebsite.com/%3Chtml%3E%3Cbody%3E%20%20This%20is%20the%20404%20error%20webpage.%20%3Cbr%3E%20The%20file%20you%20are%20looking%20for,%20do%20not%20exist.%3C/body%3E%3C/html%3E/3/

This is the 404 error webpage.

but i do the first click on the one of the buttons, it bring out the right url i want as following:

http://www.mywebsite.com/javascript/3

the problem always happen after the first click.

Could anyone help me, please.


my mod_rewrite rule in .htaccess file
Quote:

RewriteEngine On
RewriteRule ^javascript/([0-9]+)/$ /index.php?page=$1 [L]



index.php

Code:
<html>
<body>
<input type="button" id="b1" name="bb1" value="1" onClick="cButtons('b1')">
<input type="button" id="b2" name="bb2" value="2" onClick="cButtons('b2')">
<input type="button" id="b3" name="bb3" value="3" onClick="cButtons('b3')">


<script type="text/javascript">
     function cButtons(buttonN){
          var xmlHttp;
      try
     {
     // Firefox, Opera 8.0+, Safari
      xmlHttp=new XMLHttpRequest();
     }
    catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
         var rV;
         rV=xmlHttp.responseText;
         nextT(rV,buttonN);
        }
      }
    xmlHttp.open("GET","cateV.php",true);
    xmlHttp.send(null);
     
     }


     function nextT(rV, bN){
         var bOValue, bValue;
          bOValue=document.getElementById(bN).value;
          bValue=bOValue.toString();
         
          window.location.href = "/" +rV + "/" + bValue +"/";
             
      }
   }
</script>
</body>
</html>


/////////////////////////////////////////////
cateV.php

Code:
<?php
 
 $test="javascript";
 echo $test;
?>



note for i have tested in the function nextT(rV, bN).
Quote:

i have done 2 test for the values of rV.
1)i use the "window.location.href = "/javascript/" + bValue +"/"; " instead of the
"window.location.href = "/" +rV + "/" + bValue +"/";", then the browser create the
right dynamic url for me, like "http://www.mywebsite.com/javascript/3" or
"http://www.mywebsite.com/javascript/1" , it does not matter how many times i click
on the buttons.
2) i put a line of code of the " alert(" the value of rV is " + rV);"
infront of the "window.location.href = "/" +rV + "/" + bValue +"/";",
it pop up a window with the value of the javascript, it does not matter
how many times i click on.
it is very sure that the rV value already come into the function nextT(rV,bN),
but it is strange that it doesn't create dynammic url when i click the second
click on the one of the buttons.
Back to top
View user's profile Send private message MSN Messenger
Jesdisciple
Frequent Poster
Frequent Poster


Joined: 20 Oct 2007
Posts: 36
Location: Tejas

PostPosted: Sat Oct 27, 2007 6:40 pm    Post subject: Reply with quote

Your links don't work for me; I just get a redirect to www.mywebsite.com, a popup from "hitfarm" and a bunch of links offering junk.
_________________
In ALL things, strive for ><>,
Chris
Back to top
View user's profile Send private message Visit poster's website AIM Address MSN Messenger
kam
New one
New one


Joined: 27 Oct 2007
Posts: 2

PostPosted: Sun Oct 28, 2007 4:19 am    Post subject: Reply with quote

There are not problem with the link, it works for me in my site. But that's ok,
i have solved out the problem already.

i have gave up the ajax code and pass php varibal to it.

Thanks a lot
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 Advertisements
 XML & Copyright Notice 
    


Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X


Link to our site:

  


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos


Normal Bookmark


Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax


Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?


Credits:
it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert