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 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
  • 3 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 new to studying jquery.ajax. Through some tutorials, I tried some code by
I am studying an application to trigger a PHP script based on new IMAP
I am studying the new Async CTP and going through some sample code, I
I'm designing a new web project and, after studying some options aiming scalability, I
I'm new to data warehousing. First, I want to precise than my copy of
I'm pretty new to C, I've been studying someone else's code and I've found
I was studying a piece of source code from the original PowerControl Widget (
I update MySQL versition from 5.0 to 5.5. and I am new for studying
I'm pretty new to WordPress but have spent some 50 odd hours studying up
I was studying the following piece of code from WatiN which handles launching and

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.