Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6155575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:27:31+00:00 2026-05-23T20:27:31+00:00

I have two issues I’m trying to work though. The first is I’m trying

  • 0

I have two issues I’m trying to work though.

  1. The first is I’m trying to set the URL to follow the AJAX crawling scheme as described by google: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=174993
    when I load my two PHP pages for searching I currently just call:

mysite/search_advanced.php
mysite/mysite/search_basic.php

I’m trying to turn these URL into:

mysite/#!/search=advanced

mysite/#!/search=basic

I need the ability to call these URLs directly and have them generate the correct page.

  1. My second issue is I’m unable to load my pages into a div tag because each search page has it’s own set of jquery functions for onclick events.

Here is how I would like to load my search_advanced page into a div tag with an id of main:

$('#search_advanced').click(function(e) {

    $('#main').load("search_advanced.php");

    return false;

});

The header portion of my search_advanced.php page contains this:

<?php session_start();
include_once('functions/dbconn.php');
include_once('functions/functions.php');
include_once('check.php'); 
check_login('3');

$profile = getProfile($_SESSION['uid']);

if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $params = $_POST;
    if(isset($_POST['pg'])) {
    switch($_POST['pg']){
        case '10':
        $pg=10;
        break;
        case '25':
        $pg=25;
        break;
        case '50':
        $pg=50;
        break;
        default:
        $pg=10;
    }   
    }
}

function getPagination($start, $pg, $count) {
    $pager = "";
    $pages=(int)ceil($count/$pg);
    $current_page = (int)ceil(($start+1)/$pg);
    if($current_page > 1) {
        $prev_page= ($current_page-2)*$pg;
  $pager .= "<a href=\"#{$prev_page}\" class=\"pager\"><span class=\"prev\">Prev</span></a> ";
}
for ($i=1; $i<=$pages; $i++) {
    if($current_page == $i) {
    $pager .= '<strong>'.$i.'</strong> ';
    }
    else {
        $page_start = ($i-1)*$pg;
        $pager .= "<a href=\"#{$page_start}\" class=\"pager\"><span class=\"page_no\">".$i.'</span></a> ';
    }
}
if ($current_page < $pages) {
$next_page = ($current_page)*$pg;
$pager .= "<a href=\"#{$next_page}\" class=\"pager\"><span class=\"next\">Next</span></a> ";        
}
return $pager;
}

$title="Advanced Search";
$ready_script = <<<READY_SCRIPT
$(".country").change(function(){
var id=$(this).val();
var dataString = 'id='+ id;

$.ajax
({
  type: "GET",
  url: "ajax_region.php",
  data: dataString,
  cache: false,
  success: function(html){
    $("#state_id").html('<option value="-1">Any</option>'+html);
  }
});
});
$(".pager").click(function(){
   // my code here
});


$('#advanced_search').click(function(){
   // my code here
});
READY_SCRIPT;

Currently my $ready_script variable gets passed to my header.php page that gets executed from this:

$(document).ready(function() {
    <?php if (isset($ready_script)) {echo($ready_script);} ?>
}

I only want to call my header.php once now and load all my pages into my main div tag so I’m not continually hitting the server with uneeded calls everytime. After my onclick menu event is there a better way to initialize my jquery functions for the specific page I’m loading?

Any thoughts would be greatly appreciated.

Thanks,
-Paul

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:27:32+00:00Added an answer on May 23, 2026 at 8:27 pm

    Separate your javascript from your content by putting the scripts into .js files. After you load your content, load your scripts:

    $('#main').load("search_advanced.php", function () {
        $.ajax({ url: "search_advanced.js", dataType: "jsonp" });
    });
    

    If you load the js at the same time as the content, your scripts could run prematurely.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having some issues getting this MPMoviePlayerViewController to work. I have two sample URLs pointing
I have two issues:- 1. I need to be able to set the value
My code works fine in a way. I have two issues with it though.
I have two issues with my CakePHP application (its my first one in CakePHP).
I have two issues both related to (I believe) my SQL Server setup. I
I have found many people with simliar issues but no soultions...basically I have two
I have inherited a middle tier system with some multi-Threading issues. Two different threads,
I have two classes: Vehicle and Issues ....a Vehicle object can have several issues
I have two issues I have ignored so far, but I will really appreciate
I have two issues. I have Ubuntu 10.10 and I have installed git server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.