Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [AJAX]wyświetlenie jsona na stronie - zwrotnie., jak to wykonać.
casperii
post
Post #1





Grupa: Zarejestrowani
Postów: 681
Pomógł: 28
Dołączył: 14.08.2014

Ostrzeżenie: (0%)
-----


Mam kod:

Kod
jQuery.fn.delete_school = function (id) {
    var that = $(this);
$('.usun').live('click', function () {
                $.post("/ajax/AjaxUpdateData.php", {
                    remove: id
                }, function (data) {
                    if (data.status == 'success') {
                    
                    $('#info_upd_data').fadeOut(200,function(){
                                        $(this).removeClass('response-waiting').addClass('response-success').text('blabla').fadeIn(200,function(){
                                            setTimeout(function(){
                                                responseMsg.fadeOut(200,function(){
                                                    $(this).removeClass('response-success');
                                                });
                                            },3000);
                                        });
                                    });                  
                    
                    
                    
                    
                       that.parents('#TableShowEducation').remove();
                      
                    } else {
                        $('.stop').click();
                    }
                }, 'json');
});
    });
};



oraz:

  1. if(isset($_POST['remove'])){
  2. $id = intval($_POST['remove']);
  3. if(mysql_query("DELETE FROM `education` WHERE `id` = $id")){
  4.  
  5. $status = "success";
  6. $message = "Szkoła została usunięta.";
  7.  
  8. }
  9. }
  10.  
  11. $data = array(
  12. 'status' => $status,
  13. 'message' => $message
  14. );
  15.  
  16. echo json_encode($data);


Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 24.08.2025 - 19:54