jQuery + PHP getting AJAX data -


whats best way pass data jquery ajax method via php. , constructing query based of can loaded via ajax , displayed on page.

ex: clicking viewer.php?note_id=2 modular window show , ajax data in regards note_id 2 viewer.php out going viewer.php directly.

the problem using list of notes on page , separated li tags.

so best way go around this? , assure correct note_id passed notes href link?

php code selects db need fix since seems not follow desc limit 12 syntaxes

    $q_asl32 = mysql_query("select * notice order nid desc limit 12");    $r_asl32 = mysql_fetch_array($q_asl32);     $nid = $r_asl32['nid'];    $note = $r_asl32['note'];    $type = $r_asl32['type'];    $private = $r_asl32['private'];    $date = $r_asl32['date'];    $author = $r_asl32['author']; 

part 2 of same php code create notes list mysql data

 echo '    <li>    <p>    <a href="viewer.php?nid='.$nid.'" id="record-'.$nid.'">    <img src="16x16/apps/2439.png" />    &nbsp;    '.$author.', '.note_type($type).'    </a>    </p>    </li>    '; 

jquery ajax part

$.ajax({                    type: "get",                    url: "vierw.php",                    async: false,                    data: "ajax=1&nid=' + parent.attr('id').replace('record-',''),                    success: function(html){                         $("#note_utm").html(html);                         $(".loader").html("");                    }         }); 

i seem getting screwed on data function in ajax call think ajax call incorrect

here's basic example of how might use jquery update notifications area (i.e. div id of "notifications"). polls server every 5 seconds , appends returned html code coming server. of course, you'll have make sure php script returns html described above.

  $(function() {       setinterval(checkfornotes, 5*1000);   });    var checkfornotes = function() {     $.get('/get_tickets.php', function(data) {       $("#notifications").append(data);     },'html');   } 

Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -