title: AJAX: PHP function returns 1, but 'success' part says it returns 0
body: <p>I need a help with the below-given function. The function <code>mainApp.php</code> returns 1, but <code>Else</code> part of the <code>success IF</code> statement is executed. I have doubts regarding the correctness of an expression<code>function(html,msg)</code>. How to solve this problem?</p>
  
  <p><strong>UPDATE (Working code):</strong></p>
  
  <pre><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;
              }
          }
      });
  }
  </code></pre>
  
  <p><strong>mainApp.php</strong></p>
  
  <pre><code> $html_code = '&lt;table width="100%"&gt;
                  &lt;tr&gt;
                      &lt;td width="100%"&gt;
                          &lt;div class="scrollbar" id="chart"&gt;&lt;img class="displayed" src="ganttchart.php"&gt;&lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;';
  
              echo json_encode(array('msg' =&gt; 1, 'html' =&gt; $html_code));
  </code></pre>