JavaScript Ajax post to php > get php variable with xmlhttprequest ajax post variable to php,ajax post variable,ajax post

I want to update my table with javascript every couple seconds.

So far I made an ajax post request to my update.php and trigger if is set. Then do a mysql query and put the resultset in a json variable.

After this i get it with a XMLHttpRequest.

The problem is that every XMLHttpRequest example uses echo json. But when I put my echo json in my isset post check it wont return anything anymore.

I think the problem is that it can't echo?

This is my code:

PHP:

if (isset($_POST["updateTable"])) {
        $result = mysqli_query($con,"SELECT * FROM users");
        $row = mysqli_fetch_row($result);

        $rsArray[] = array();
        while ($row) {
            $rsArray[] = $row;
            $row = mysqli_fetch_row($result);
        }
        echo json_encode($rsArray);
    }

AJAX:

var updateTable = "true";
    setTimeout(function(){ 
        $.ajax({
            type: 'POST',
            url: '../EXT_PHP/update.php', 
            data: { updateTable: updateTable }
        });
        console.log(updateTable);
    }, 3000);

xmlhttpRequest:

setTimeout(function(){ 
    var oReq = new XMLHttpRequest(); 
    oReq.onload = function() {
        alert(this.responseText);
    };
    oReq.open("get", "../EXT_PHP/update.php", true);
    oReq.send();

}, 3000);

Answer:1

let's imagine I've declared some styles (either directly on my html document or by external css file(s)): <style> .Red { background-color: red; } .Green { background-color: green; } .Blue { ...

let's imagine I've declared some styles (either directly on my html document or by external css file(s)): <style> .Red { background-color: red; } .Green { background-color: green; } .Blue { ...

i am Creating a page that search all client details... i am also using json for autocomplete textbox with data of datatable... <script type="text/javascript"> $(document).ready(function () { ...

i am Creating a page that search all client details... i am also using json for autocomplete textbox with data of datatable... <script type="text/javascript"> $(document).ready(function () { ...

  1. textbox html
  2. textbox definition
  3. text box google docs
  4. text boxes
  5. textbox css
  6. textbox c#
  7. textboxfor
  8. textbox javascript
  9. textbox wpf
  10. textbox matlab
  11. textbox bootstrap
  12. textbox latex
  13. textbox events
  14. textbox javafx
  15. textbox vba
  16. textbox onchange
  17. text box in google sheets
  18. text box in word
  19. textbox tkinter
  20. textbox app

I want to have a popup in Jquery mobile that would not stop users from interacting with a page and data-dismissible="false" that is the popup would not disappear when another part of the page is ...

I want to have a popup in Jquery mobile that would not stop users from interacting with a page and data-dismissible="false" that is the popup would not disappear when another part of the page is ...

  1. draggable modal popup bootstrap 4
  2. draggable modal popup bootstrap
  3. draggable modal popup
  4. draggable modal popup jquery
  5. draggable modal popup angularjs
  6. draggable modal dialog

I'm using angular to manage my select dropdown, from an array. The entries in the array itself are all lowercase. The "selected" variable to be used elsewhere in the code wants to be lowercase. The ...

I'm using angular to manage my select dropdown, from an array. The entries in the array itself are all lowercase. The "selected" variable to be used elsewhere in the code wants to be lowercase. The ...