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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:08:10+00:00 2026-05-24T08:08:10+00:00

OK so I am going slightly insane. I am trying to do a simple

  • 0

OK so I am going slightly insane. I am trying to do a simple thing that I have managed many times in the past, and that is to send data through jquery .get function via a simple onClick attribute.

I have checked that the jquery.js file is loading correctly through firebug’s “net” panel, I have tried loading the jquery script from within the tag and also just before the tag; always using $(document).ready(function() { } wrapped round the script.

I just dont know what else to check to find the error.

The error is listed in firebug’s console as “…. is not defined”

Below you can find the code I am using, any help would be great; I am hoping I have simply been daft and missed a ; or something.

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            function productString(product) {
                $.get("http://<? echo ROOT; ?>includes/forms.php", { product: product }, function(data) {
                    //$('#popup-content').html(data);
                    alert('Load was performed.');
                });
            }
        });
    </script>
</head>

<body>
    <form>
        <input type="radio" value="tester" onClick="productString(this.value)">
        <label>Test 1</label>
    </form>

    <a href="#" name="test" onClick="productString('tester2')">This is a test</a>

</body>

Thank you in advance for any help community.

  • 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-24T08:08:11+00:00Added an answer on May 24, 2026 at 8:08 am

    The reason this is not working is that productString exists in the namespace defined by the anonymous function you pass to $(document).ready. When the browser acts on the onclick it is looking for the function in the global namespace and so doesn’t find it. As the function does not rely on any of the DOM having been processed you do not need to wrap it in $(document).ready.

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

Sidebar

Related Questions

Going mad now. I have a MVC solution that i've upgraded from MVC 1
Going through the microsoft authentication tutorial listed here they have you create a master
I'm going to re-ask this question in a slightly different way. Say I have
I'm designing a website that is going to have multiple nested divs for the
Going slightly crazy here. I'm making an Ajax call using jQuery.post as follows: $.post('php/print.php',{data:dS},function(res){...
I was going through the tutorial of binary tree . And I am slightly
I'm going through a phase of trying to avoid temporary variables and over-use of
I have to work out a small framwork that is going to be used
Going through some of my older Delphi projects and upgrading them to D2009, as
Going through Javascript documentation, I found the following two functions on a Javascript object

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.