Ajax call with pagination

here is my page.
http://www.awesomescreenshot.com/image/1527838/0d20bd6585b9175d74efe87139b7786c

as in page mention , in menu part as i click on the “projects” or “interview” or etc , the specific content of that category should be displayed. this work has been done with ajax call as below mentioned.

my problem is with pagination.

my problem is as below:

as I filter content by ajax call whole php code is received in ajax call as a response. so in pagination url get change.

then i need to remove extra words from url. like this

<?php echo str_replace("/?q=$name", "",$pagination->pageURL($r)) ?>

and if i remove this extra code from pagination nothing works good. and i dont remove anything form url contents works perfectly but other information not get displayed.

what changes i need to do with pagination logic if whole code is receives as ajax response.