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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:45:17+00:00 2026-06-04T19:45:17+00:00

I need a help with the below-given function. The function mainApp.php returns 1, but

  • 0

I need a help with the below-given function. The function mainApp.php returns 1, but Else part of the success IF statement is executed. I have doubts regarding the correctness of an expressionfunction(html,msg). How to solve this problem?

UPDATE (Working code):

function click_function_ps() {
    $.ajax({
        url: 'callpage.php?page=optim/mainApp.php',
        data: 'myParam='+$('#myParam').val(),
        dataType: 'json',
        success: function(output){
            if(output.msg === 1){
                $('#myContainer').html(output.html);
            } else {
                $dialog.dialog('open');
                return false;
            }
        }
    });
}

mainApp.php

 $html_code = '<table width="100%">
                <tr>
                    <td width="100%">
                        <div class="scrollbar" id="chart"><img class="displayed" src="ganttchart.php"></div>
                    </td>
                </tr>
            </table>';

            echo json_encode(array('msg' => 1, 'html' => $html_code));
  • 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-04T19:45:19+00:00Added an answer on June 4, 2026 at 7:45 pm

    The response returned is in the first argument. The second one is usually not interesting.

    success(data, textStatus, jqXHR)
    

    A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR object.

    I’d also suggest you to rename html to something more meaningful such as data or response and add dataType: 'json' to your ajax arguments. Then make your PHP script return json_encode(array('msg' => 1, 'html' => $your_html_code)) and use data.msg and data.html in your function.

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

Sidebar

Related Questions

need help in error in database pivot. i have table tamed table_score like below:
I need help on concatenation. I have a Title which is displayed below like
The function below returns all folders in a given directory down to multiple levels.
All, I have confuse below may need your help suppose I have a row
I need help solving the problem below. I am creating a Windows Forms Application
I need help with the SQL ORDER BY clause. In my table below I
Hello I need help in writing a query. Below is my DB structure id
The coding below seperates the $state data, I need help putting the var_dump info
I need your help with making comments show below my articles. At the moment
What tool do I need to generate XML intellisense help file as shown below?

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.