0

I am getting JSON response through the adapter. How to populate this into dropdown list. I tried inserting php code into my HTML code. But it was printing the code itselp.

 HTML Code:



 <!DOCTYPE HTML>
    <html>
       <head>
              <meta charset="UTF-8">
              <title>TestApp</title>
              <meta name="viewport" content="width=device-width, initial-scale=1.0,
    maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
              <link rel="shortcut icon" href="images/favicon.png">
              <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
              <link rel="stylesheet" href="css/TestApp.css">
              <script>window.$ = window.jQuery = WLJQ;</script>



       </head>
       <body id="content" style="display: none;">
              <!--application UI goes here-->
              SOWRUN APP</br>



    <p> employeenumber: <input type="text" id="employeenumber"/></br>


    <p><br>employeename:       <input type="text" id="employeename"/></br></p>
    <p><br>employeeemail:      <input type="text" id="employeeemail"/></br></p>
    <p><br>employeeadID:       <input type="text" id="employeeadID"/></br></p>
    <p><br>businessUnit:       <input type="text" id="businessUnit"/></br></p> 
    <select name="country" id="country">

    <option>Select Country</option>
    <option>INDIA</option>
    <option>USA</option>
    </select>



              <p><br>city:               <input type="text" id="city"/>      </br></p>
             <p><br>location:           <input type="text"       id="location"/>
               <p><br>bloodGroup:         <input type="text"   id="bloodGroup"/>
                <p><br>gender:               <input type="text" id="gender"/></br></p>
              <p><br>tShirt:                    <input type="text" id="tShirt"/>


     <input type="button" onclick="submitName()" value="Submit"/></br>



              <script src="js/initOptions.js"></script>
              <script src="js/TestApp.js"></script>
              <script src="js/messages.js"></script>
       </body>
  </html>

I want to have the following JSON response populated into “country” dropdown list which I am getting from the adapter.

JSON response: Invocation Result of procedure: 'getCountries' from the Worklight Server:

{
 "array": [
      {
         "con_name": "India"
      },
      {
         "con_name": "Portugal"
      },
      {
         "con_name": "Spain"
      },
      {
         "con_name": "UAE"
      },
      {
         "con_name": "USA"
      },
      {
         "con_name": "Mexico"
      },
      {
         "con_name": "Australia"
      },
      {
         "con_name": "Romania"
      },
      {
         "con_name": "Phillipines"
      },
      {
         "con_name": "Netherlands"
      },
      {
         "con_name": "UK"
      },
      {
         "con_name": "Singapore"
      },
      {
         "con_name": "Switzerland"
      },
      {
         "con_name": "Hungary"
      },
      {
         "con_name": "USAWest"
      },
      {
         "con_name": "USA South"
      },
      {
         "con_name": "Mexico"
      },
      {
         "con_name": "Brazil"
      },
      {
         "con_name": "China"
      },
      {
         "con_name": "NewZealand"
      },
      {
         "con_name": "Poland"
      },
      {
         "con_name": "Japan"
      },
      {
         "con_name": "Germany"
      },
      {
         "con_name": "Canada"
      },
      {
         "con_name": "France"
      },
      {
         "reg_AD_ID": "111111"
      }
   ],
   "isSuccessful": true,
   "responseHeaders": {
      "Connection": "Keep-Alive",
      "Content-Length": "594",
      "Content-Type": "text\/html",
      "Date": "Mon, 29 Jul 2013 07:01:37 GMT",
      "Keep-Alive": "timeout=5, max=100",
      "Server": "Apache\/2.2.21 (Win32) PHP\/5.3.8",
      "X-Powered-By": "PHP\/5.3.8"
   },
   "responseTime": 85,
   "statusCode": 200,
   "statusReason": "OK",
   "totalTime": 85
}
4

1 に答える 1