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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:19:23+00:00 2026-06-08T00:19:23+00:00

User fills input texts, presses the button Submit. The data sends to the server

  • 0

User fills input texts, presses the button Submit. The data sends to the server to be stored and result returned back. Fancybox window with result appears. My question is: how to display the result $res1 in the fancybox?

$.ajax({
    type:"POST",
    url:"index/success",
    async:false,
    data:{ name:name, password:password},
    success:function ()
    {
        var html='$res1 from the server should be here instead of this string';//var html=$res1.
        $.fancybox(
            {
                content: html,//fancybox with content will be displayed on success resul of ajax
                padding:15,
            }
        );
    }
});

=========================

OK, still doesn’t work (returns in the fancybox the whole page+ the word “hello” on top instead of the message “hello”). Below is my update regarding the answers below, that doesn’t work properly:

PHP:

<?php
    $res1="hello";... // handle logic here
    echo $res1; // print $res1 value. I want to display "hello" in the fancybox.
?>

AJAX

$.ajax({
    type: "POST",
    url: "index/success",
    async: false,
    data: {
        name: name,
        password: password
    },
    success: function (html) {
       $.fancybox(
       {
         content: html,//returns hello+page in the fancybox

          //if I use the string below instead of the upper one, the fancybox shows "The requested content cannot be loaded. Please try again later."
         // content: console.log(html) 


         padding:15,
    }
});

=============
New update:
Fixed!!! The problem was the data ( “hello” in the example above) was sent to the template in the framework, and template was displayed.
That’s why.
Fixed.
Thank you.
Everybody.

  • 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-08T00:19:26+00:00Added an answer on June 8, 2026 at 12:19 am

    Assuming you’re using PHP:

    PHP:

    <?php
        ... // handle logic here
        echo $res1; // print $res1 value
    ?>
    

    AJAX:

    $.ajax({
        type: "POST",
        url: "index/success",
        async: false,
        data: {
            name: name,
            password: password
        },
        success: function (html) {
            // given that you print $res1 in the backend file,
            // html will contain $res1, so use var html to handle
            // your fancybox operation
            console.log(html);
        }
    });
    

    Enjoy and good luck!

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

Sidebar

Related Questions

I have a form whereby a user fills it in and clicks submit. This
I'm filling in a Word template with data that's been collected from user input.
I have a XAML input form which the user fills out. I want to
I have a quotation form where the user fills out the boxes, clicks submit
hey i would like to show an table when user fills an input. What
I have multiple pdf files. Based on user input i am loading the pdf
I have a PHP script that creates other PHP files based on user input.
When using <input type=file multiple> it's possible for the user to choose multiple files.
Example: the user fills in everything but the product name. I need to search
After the user fills my backing bean with info through the forms, I want

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.