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 787785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:15:38+00:00 2026-05-14T21:15:38+00:00

I have a php function which inserts a searchbar into each page on a

  • 0

I have a php function which inserts a searchbar into each page on a website.

The site checks to see if the user has javascript enabled and if they do it inserts some jquery ajax stuff to link select boxes (instead of using it’s fallback onchange=”form.submit()”).

$.getJSON works perfectly for me in other browsers except in IE, if I do a full page refresh (ctrl+F5) in IE my ajax works flawlessly until I navigate to a new page (or the same page with $PHP_SELF) either by submiting the form or clicking a link the jquery onchange function fires but then jquery throws an error:

Webpage error details

Message: Object doesn't support this property or method

Line: 123

Char: 183

Code: 0

URI: http://~#UNABLE~TO~DISCLOSE#~/jquery-1.4.2.min.js

It seems like jquery function $.getJSON() is gone???

This seems to be some kind of caching issue as it happens on the second page load but I think i’ve go all the caching prevention in place anyways, here’s a snipet of the code that ads the jquery functions:

if (isset($_SESSION['NO_SCRIPT']) == true && $_SESSION['NO_SCRIPT'] == false)
        {
            $html .= '<script type="text/javascript" charset="utf-8">';
            $html .= '$.ajaxSetup({ cache: false });';
            $html .= '$.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) {   
                        alert(textStatus);
                        alert(errorThrown);
                        alert(XMLHttpRequest.responseText);
                        }});';
            $html .= '</script>';

            $html .= '<script type="text/javascript" charset="utf-8">';
            $html .= '$(function(){  $("select#searchtype").change(function() { ';
            $html .= 'alert("change fired!"); ';
            $html .= '$.getJSON("ajaxgetcategories.php", {id: $(this).val()}, function(j) { ';
            $html .= 'alert("ajax returned!"); ';
            $html .= 'var options = \'\'; ';
            $html .= 'options += \'<option value="0" >--\' + j[0].all + \'--</option>\'; ';
            $html .= 'for (var i = 0; i < j.length; i++) { options += \'<option value="\' + j[i].id + \'">\' + j[i].name + \'</option>\'; } ';
            $html .= '$("select#searchcategory").html(options); }) }) }) ';
            $html .= '</script> ';

            $html .= '<script type="text/javascript" charset="utf-8"> ';
            $html .= '$(function(){  $("select#searchregion").change(function() { ';
            $html .= 'alert("change fired!"); ';
            $html .= '$.getJSON("ajaxgetcountries.php", {id: $(this).val()}, function(j) { ';
            $html .= 'alert("ajax returned!"); ';
            $html .= 'var options = \'\'; ';
            $html .= 'options += \'<option value="0" >--\' + j[0].all + \'--</option>\'; ';
            $html .= 'for (var i = 0; i < j.length; i++) { options += \'<option value="\' + j[i].id + \'">\' + j[i].name + \'</option>\'; } ';
            $html .= '$("select#searchcountry").html(options); }) }) }) ';
            $html .= '</script> ';
        }; return $html;

remember, this is part of a php function that inserts a script into the html and sorry if it looks a bit messy, I’m new to PHP and Javascript and I’m a bit untidy too 🙂

Please also remember that this works perfectly in IE on the first visit but after any navigation I get the error.

  • 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-14T21:15:39+00:00Added an answer on May 14, 2026 at 9:15 pm

    Okay, I found my answer. The problem is with IE and this line of code in the tag of each web page:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

    I had my tag declaring jquery before this line and it needs to go after.

    this must be a bug in IE. It causes a weird result don’t you think?

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

Sidebar

Ask A Question

Stats

  • Questions 433k
  • Answers 433k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You were very close... the query should be: select distinct… May 15, 2026 at 3:03 pm
  • Editorial Team
    Editorial Team added an answer Short answer: Always. Long answer: Always. That's what they are… May 15, 2026 at 3:03 pm
  • Editorial Team
    Editorial Team added an answer It may be due to the fact that Notepad inserts… May 15, 2026 at 3:03 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.