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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:50:58+00:00 2026-05-20T11:50:58+00:00

I am new to studying jquery.ajax. I want to paste some data from a.php

  • 0

I am new to studying jquery.ajax. I want to paste some data from a.php to b.php.
Here is my code:

a.php

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function () {      
var params = "value=" + $('#send').text();   
$.ajax({        
     url:'b.php',        
     type:'post',                 
     dataType:'html',            
     data:params,  
     success:function(data){  $("#result").html($(data).html('#aa')); }
});
});
</script>
<body>
<div id="result"></div>//sometimes the return data is empty, so this part just return: <div="aa"></div>
<div id="send">apple</div>

b.php

<?php
echo '<div id="aa">';
//'.$_REQUEST['value'].' will put in some process here, but sometimes the return data is empty.
echo '</div>';
?>

How and where do I add a judgement, if <div id="aa"></div> is empty, add sorry, there is no result between it

so in a.php, the imformation will show: <div id="result"><div id="aa">sorry, there is no result</div></div>

Thanks.

  • 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-20T11:50:59+00:00Added an answer on May 20, 2026 at 11:50 am

    Change your AJAX call to be:

    $(document).ready(function () {      
    var params = "value=" + $('#send').text();   
    $.ajax({        
         url:'b.php',        
         type:'post',                 
         dataType:'html',            
         data:params,  
         success:function(data){  
             $("#result").html($(data).html('#aa'));
            if ( $("#aa").html() == "" ) {
                $("#aa").html("sorry, there is no result");
           }
        }
    });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am studying an application to trigger a PHP script based on new IMAP
I'm pretty new to WordPress but have spent some 50 odd hours studying up
I was studying a piece of source code from the original PowerControl Widget (
I'm studying this code: http://www.w3style.co.uk/a-lightweight-and-flexible-front-controller-for-php-5 In it the author uses a static function to
I am new in Flex Environment, specifically flex3. I've been studying it for 1
New to javascript/jquery and having a hard time with using this or $(this) to
The new extensions in .Net 3.5 allow functionality to be split out from interfaces.
In new C++ code, I tend to use the C++ iostream library instead of
My jqGrid that does a great job of pulling data from my database, but
I am studying the new Amazon RDS product and it seems it can be

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.