Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Thanked 0 Times in 0 Posts

    Ajax Search result, disable other script

    I have a search function to display all of the data into the table. I used two js which is tablesort.js and paginate.js to sort my table. Here the problem, I used ajax to call the result page, however the javascript inside the page could not run. Hence my table cannot be sort.

    To get search result
    PHP Code:
    <h3>Search Results</h3>
    div id="msg"> </div>
    div id="search-result"
    function createObject() {
    var request_type;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
    request_type = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
    request_type = new XMLHttpRequest();
    return request_type;
    var http = createObject();
    /* -------------------------- */
    /* SEARCH */
    /* -------------------------- */
    function searchNameq() {
    searchq = encodeURI(document.getElementById('searchq').value);
    type = encodeURI(document.getElementById('type').value);
    document.getElementById('msg').style.display = "block";
    document.getElementById('msg').innerHTML = "Searching for <strong>" + searchq+"";
    // Set te random number to add to URL request
    nocache = Math.random();
    http.open('get', 'in-search.php?name='+searchq+'&type='+type+'&nocache = '+nocache);
    http.onreadystatechange = searchNameqReply;
    function searchNameqReply() {
    if(http.readyState == 4){
    var response = http.responseText;
    document.getElementById('search-result').innerHTML = response;
    Result Page which consist 2 js
    PHP Code:
    <script type="text/javascript" src="js/tablesort.js"></script>
    <script type="text/javascript" src="js/paginate.js"></script> 
    Last edited by Erickk; 11-27-2011 at 11:19 PM.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts