2012-11-05 14 views
5

JQuery Mobile simpledialog() czyści moje dynamiczne dane ze strony. Właściwie mam listę, z której usuwam rekord za pomocą zachęty simpledialog . Ale to wyczyści moją dynamicznie generowaną listę, więc muszę przeładować stronę, aby odzyskać listę. Czy jest jakaś opcja, aby się tego pozbyć?JQuery Mobile simpledialog usuwa moje dynamiczne dane ze strony

Poniżej jest mój kod:

$('#Delete').simpledialog({ 

'mode': 'bool', 
'prompt': 'Are you sure to deactivate'?', 
'useModal': true, 
'buttons': { 
    'OK': { 
     click: function() { 
      $('#dialogoutput').text('OK'); 
      $.ajax({ 
       type: 'POST', 
       url: deactivateUrl, 
       data: { postVar: postDeactivate }, 
       beforeSend: function() { 
        showPageLoading("De-Activating.."); 
       }, 
       success: function (data) { 
        hidePageLoading(); 
        if (data = 'true') { 
         notification("Record Deactivated!"); 
         location.reload(); 
        } 
        else { 
         notification("Deactivation failed."); 
        } 
       }, 
       error: function() { 
        //alert("Error"); 
       } 
      }); 

     } 
    }, 
    'Cancel': { 
     click: function() { 
      $('#dialogoutput').text('Cancel'); 
      location.reload(); 
     }, 
     icon: "delete", 
     theme: "c" 
    } 
} 
}); 

Odpowiedz

0

Trzeba,

if (data = 'true') { 
    notification("Record Deactivated!"); 
    location.reload(); 
} 
else 
{ 
    notification("Deactivation failed."); 
} 

to:

if (data = 'true') 

Will zawsze być 'prawdziwe' jak ustawiasz go do ' prawda "przy użyciu jednego równa się.

Może chciałeś:

if (data == 'true') 

LUB

if (data === true) 
Powiązane problemy