CopyPastor

Detecting plagiarism made easy.

Score: -1; Reported for: Open both answers

Possible Plagiarism

Plagiarized on 2018-02-11
by Aqrun

Original Post

Original - Posted on 2017-06-02
by Rahul



            
Present in both answers; Present only in the new answer; Present only in the old answer;

js:
(function(){ function liveCheck(){ var search = $('#statusID').val(); $.ajax({ url:'check_live.php', data:{search:search}, type:'POST', success:function(data){ if(data.trim == ''){ location.reload(); }else{ $('#result').html(data); window.setTimeout(function(){ liveCheck(); }, 10000); } } }); }
$(function(){ liveCheck(); }); })(jQuery)
php:
<?php if(isset($_POST['search'])){ $current_status = $_POST['search']; $online_status = Online_status::find_by_id(1); if($current_status != $online_status->status){ $data = ''; }else{ $data = 'some html'; } echo $data; }
`echo $sql;` will return either 0 or 1
you can update the class of the button without reloading as
success: function(data) { if(data == 1) // success { $('.status-checks').each(function(){ if($(this).attr(data) == $(current_element).attr('data')) { $(this).addClass('btn-success'); $(this).text('Paid'); } }) }else // failed { $('.status-checks').each(function(){ if($(this).attr(data) == $(current_element).attr('data')) { $(this).addClass('btn-danger'); $(this).text('Unpaid'); } }) } } });

        
Present in both answers; Present only in the new answer; Present only in the old answer;