Abdul Ashy Abdul Ashy - 4 months ago 6x
jQuery Question

AJAX get function in jQuery

Help me get a text field number then make a multiplication table of the number. using AJAX in jQuery. The below script is not working for me

var numValue = $("#num").val();
$.get("path.php", {number: numValue} , function(data){


you are trying to get a html element value then request the server then display the fetched details to your browser below is the whole example and i have included the script in it

<!DOCTYPE html>

<html lang="en">


  <meta charset="utf-8">


  <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

  <script type="text/javascript">



            // Get value from input element on the page
               var numValue = $("#num").val();

            // Send the input data to the server using get
              $.get("../php/create-table.php", {number: numValue} , function(data){

           // Display the returned data in browser







   <label>A number Between 10 t0 100 <input type="text" id="num"></label>

    <button type="button">Generate Table</button>

         <div id="result"></div>