prevent page reloading second view in jquery mobile -


i new jquery mobile, in index.html page when click on search button list generate dynamically using ajax call, when click on list go display page , display values. problem when come display page search , click on list again ajax call happen 2 times(means page reloading 2 times). using $(document).on('pageinit', function() {});

please fine code below:

index.html

<input type="button" id='sear' value="search">    <div id="output" data-dom-cache="true">   <ul data-role="listview" data-inset="true" id="display">   </ul>  </div> 

search.js

 $.post("mobileser", {data},function(res) {   $('#output ul').append("<li> <a href=./mobile/pages/details.html data-ajax='false'>"+'incident no: '+v+' </li>'+'</a>');   $('#display').listview('refresh');  

details.html

<input type="text" id="module"  name="module" placeholder="autocomplete" data-mini="true"  > <input type='hidden' value='' name="hmoduleid" id="hmoduleid" class="autocompletecheck" /> 

viewdetails.js

$(document).on(pageinit, function() {  $.post("url", {data}, function(res) {   $(module).val(value);  },) }) 

please me...

use e.preventdefault() prevent postback based on condition


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -