javascript - how can append db values to a href (phonegap) -


this html page nextpage.html im lookig display db values category_id, category_name php controller in html page. clicking on category_name want go next html page , category_id passed page

pls me.....pls

   </div>      <div data-role="main" class="ui-content">              <form id="nextform" >              <ul data-role="listview" data-inset="true" id="category">                     <li>                <a></a>                </li>               </ul>                        </form>     </div> 

my js nextpage.js

var base_url = "http://dev.edfutura.com/nithin/jps/edfuturamob/"; $(document).on("pageinit", "#catlist", function() {           var submiturl = base_url + "categorylist/get_categorylist";           //$("#loading").css("display", "block");             $.ajax({             url: submiturl,             datatype: 'json',             type: 'post',             success: function(response) {                 // pls             },              error: function() {                 alert("error");              }            }); 

controller categorylist.php

function get_categorylist() {    $cat = $this - > categorylist_model - > get_cat();    echo json_encode($cat); 

}

you can save data in sessionstorage , paint when want:

var session = (typeof(storage) !== "undefined") ? window.sessionstorage : null;    $.ajax({         url: submiturl,         datatype: 'json',         type: 'post',         success: function(response) {             if(session) {                 // fill here data want                 session.setitem("data", response.data);              }         },          error: function() {             alert("error");          }     }); 

to read it:

   if(session) { alert(session.getitem("data"); } 

good luck


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -