Friday, 15 May 2015

javascript - Accessing live data created by jQuery in php -


I have a method in my jQuery code that generates rows and adds them in my table in HTML as follows ( And works fine):

  $ (document) .ready (function () {$ ("# textDateAndTime"). Datetimepicker (); $ (document) .on ("click" , "# UlInvite li h6", function () {var h = this; var selected = h.innerText.split ('') [0]; var myExp = new RegExp (selected, "i"); $ .getJSON ( "Json_data.php", function (data) {$ .each (data, function (key, val) {if ((val.username.search (myExp)) == 0} {var output = "& lt; tr & Gt; "+" & lt; td & gt; "+ Val.username +" & lt; / td> "+" & lt; td> "+ val.firstName +"  "+" & lt; td & gt; "+ Val.lastName +" & lt; / td> "+" & lt; / tr & gt; "; $ (" # tableInvite "). Attachment (h) .parentNode);}}};})}}  

And this is my table, which is simple in the HTML file:

  & lt; Table name = "tableinevat" id = "tableInvite" border = "1px solid black" & gt; & Lt; / Table & gt;  

Then I want to use the lines generated in my PHP file, which is posted in HTML in & lt; Form & gt; The code is called in the tag. I use the simple_html_dom.php file to parse my table with the search method, but it's & lt; Td> Elements are not received because they were generated by JQuery, while they will be found properly if they were originally in the HTML file.

  is required ('simplehtmldom_1_5 / simple_html_dom.php'); $ Html = file_get_html ('add_meeting.html'); Foreach ($ html- & gt; Mill ('tr') as the $ line) {$ username = $ row-> Search ('td', 0) - gt; Plaintext; $ First name = $ row- & gt; Search ('TD', 1) - & gt; Plain text; $ Lastname = $ row- & gt; Search ('TD', 2) - & gt; Plain text; }  

but it never goes to foreach because it & lt; Tr & gt; element can not be found.

So, how can I generate these lines?

Thank you.


No comments:

Post a Comment