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

  • SEARCH
  • Home
  • 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 8271625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:53:53+00:00 2026-06-08T06:53:53+00:00

I have a form which lets the user enter their search term and it

  • 0

I have a form which lets the user enter their search term and it then gets passed to another page via jquery ajax post. On the process page I have the following code:

<?php $searchText = $_REQUEST["searchText"]; ?>

<script type="text/javascript"> 
$('.facebookfeed').append('<p>Loading your results</p>');
  var url = 'https://graph.facebook.com/search?q=';
  var url = url+searchText.value;
  var url = url+'&type=post&limit=60&callback=?';       
    $.getJSON(url,function(json){
    console.log(data);
        var html = "<ul>";
            if (json.data == ''){html += '<li><h2>Sorry, no results were found. Try with another search term.</h2>'; }
        $.each(json.data,function(i,fb){
            if (!fb.message == ''){
                html += '<li><div class="box">'
                html += '<a href="http://www.facebook.com/'+ fb.from.id +'" target="_blank"><img src="https://graph.facebook.com/' + fb.from.id + '/picture" /></a>';
                html += '<p><span class="name"><a href="http://www.facebook.com/'+ fb.from.id +'" target="_blank">' + fb.from.name + '</a></span>  <br />';
                html += fb.message;
                html += '</p></div></li>';

            }
            });
        html += "</ul>";
        $('.facebookfeed').animate({opacity:0}, 500, function(){
                $('.facebookfeed').html(html);
                                                              });
        $('.facebookfeed').animate({opacity:1}, 500);

    });


</script> 

This code works properly on Chrome and Safari but in Firefox I am getting the following error:

Error: searchText is not defined

I can’t seem to figure out what the problem is here? Any help is greatly appreciated.

  • 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-06-08T06:53:56+00:00Added an answer on June 8, 2026 at 6:53 am

    Your searchText variabale is in php, but you are trying to use it in a javascript. Try transferring it to a javascript variable var searchText = "<?= $searchText?>";.

    Then your javascript will look something like this:

    <script type="text/javascript"> 
        $('.facebookfeed').append('<p>Loading your results</p>');
        var searchText = "<?= $searchText?>";
        var url = 'https://graph.facebook.com/search?q=';
        url = url+searchText;
        url = url+'&type=post&limit=60&callback=?';   
        $.getJSON(url,function(json){
            ...    
        });
        ...
    </script> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have code like this. which is actually a form .which lets user updates
I have a requirement which lets the user search for properties using friendly urls.
I have a form which lets you add names to the table and shows
I have a form which POST's its data via AJAX: $.ajax({ type: POST, url:
I have a form which has three inputs when the page loads -- 2
So I have a form that lets a user create a new team. Our
I have a form on my page which contains two select dropdowns. The first
I have an app that lets the user search over a number of fields
I have this form in which the user puts in the total quantity of
I have a zend form that lets the user fill out attributes of an

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.