views:

64

answers:

3

Hi guys, I have read related Q&A's for this is question, but still I am confused on this, can somebody help me on this?
What I am doing: my url is : www.mysite.com/home.php I have two files: home.php and get_data.php, in home.php i am calling get_data.php with the use of jquery. the code for jquery is:

$(document).ready(function(){
                   $("#btn_submit").bind('click', function(){
                   $.get('/get_data.php?tnm='+$('#tnm').val(), '', function(data){
                $('#get_info').html(data);
        });
    }); });

Here #tnm is name of the textbox & #get_info is the id of div tag. I am accessing $_GET['tnm'] in get_data.php. What I want is: When I search username with : www.mysite.com/username, I should get that user's result accordingly. How can I rewrite the url for this? Please help! Please feel free for any details.

+1  A: 

Have you looked at this for example: http://httpd.apache.org/docs/2.0/misc/rewriteguide.html

Also, why do you use javascript for this?

Zeta Two
I just gave the js code to let you know guys, that how I am getting user's data (get_data.php) on home.php. I am able to do this when rewriting on same page, but here there are two different pages. and I want like this: suppose user 'A' visits site with "www.mysite.com/A" , he should get his result page
Rishi2686
A: 

I am wondering why you are trying to use .HTACCESS for Ajax calls, any way http://httpd.apache.org/docs/2.0/misc/rewriteguide.html is the best place :)

eyoosuf
thank you eyoosuf, will go through that.
Rishi2686
A: 

Please try this plugin it can be useful. jquery.address

Shoaib
sorry, I thought if you want to update URL after fetching content via ajax so that it can be bookmarked for direct access.
Shoaib
thank you Shoaib, will go through that.
Rishi2686