EasyUI Forum
May 20, 2024, 10:37:35 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Load Form Data from URL or MySql data  (Read 11998 times)
karogel
Newbie
*
Posts: 28


View Profile
« on: October 07, 2015, 09:01:44 PM »

Im using this code to load the basic info of client and test load info based on sample ID. The function frm_maker_show works fine but the function loadCIRinfo to load the test info does not work. I've attached the url file get_latestCIRdata.php. Please help

<a href="javascript:void(0)" class="easyui-linkbutton" onclick="loadCIRinfo()" style="width:160px">Load Latest CIR info</a>

<script type="text/javascript">
      function frm_maker_show(){
         var row = $('#dgrid_loanapp').datagrid('getSelected');
         if (row){
            urldata = 'modules/application/get_maker_data.php?id='+row.loanAppID;
            $('#dlg_investigate_maker').dialog('open').dialog('setTitle','Credit Investigation - Maker');
            $('#fm_investigate_maker').form('load',row);
            url = 'modules/application/update_investigate_maker.php?id='+row.loanAppID;
         }
      }
      
      function loadCIRinfo(){
                     var newLoanID = 944;
           urldata = 'modules/application/get_latestCIRdata.php?id='+newLoanID;
           $('#fm_investigate_maker').form('load',urldata);
      }


//=== get_latestCIRdata.php ======

<?php
   include '../data/conn.php';
   $id = intval($_REQUEST['id']);
   
   $rs = mysql_query("select *, DATE_FORMAT(appdate,'%d/%m/%Y') from tblloanapp app left join tblmasterdata master on app.makermasterDataID=master.masterdataid
                  where loanAppID=" . $id );
   $rows = array();

   while($r = mysql_fetch_assoc($rs)) {
     $rows[] = $r;
   }

   echo json_encode($rows);   

?>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: October 08, 2015, 01:47:22 AM »

The json result returned from 'get_latestCIRdata.php' should be a single object instead of an array objects.
Logged
karogel
Newbie
*
Posts: 28


View Profile
« Reply #2 on: October 08, 2015, 01:50:24 AM »

It works. thank you..here's my code:

   include '../data/conn.php';
   $id = intval($_REQUEST['id']);
   
   $rs = mysql_query("select *, DATE_FORMAT(appdate,'%d/%m/%Y') from tblloanapp app left join tblmasterdata master on app.makermasterDataID=master.masterdataid
                  where loanAppID=" . $id );

   $result = mysql_fetch_array($rs);
   echo json_encode($result);   
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!