1

I am new to Jquery mobile, In my Index.html page when I click on search button list will generate dynamically using ajax call, when I click on list It will go to display page and display all the values. Problem is when I come back from display page to search and click on list again ajax call happen two times(means Page is reloading two times). I am using $(document).on('pageinit', function() {});

Please fine the 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 help me...

Omar
  • 32,302
  • 9
  • 69
  • 112
Subha Chandra
  • 751
  • 9
  • 23

1 Answers1

0

Use e.preventDefault() to Prevent Postback based on you condition

Neeraj Dubey
  • 4,401
  • 8
  • 30
  • 49