title: How to pass form value to PHP variable with AJAX call?
body: <p>Having issues anyone has any ideas? I have only posted was is necessary for the code. I basically have an HTML form I want to pull the value from a field on a form before it's submitted run an ajax call and populate another field. I think if I could get that Txt that is entered in the form over to a PHP variable on the modcreate.php it will work. because if I manually enter the details without the variable it works. </p>
  
  <p>mainpage.php</p>
  
  <p>Relevant parts from form</p>
  
  <pre><code>  &lt;tr&gt;
      &lt;th&gt;Service Tag:&lt;/th&gt;
      &lt;th&gt;&lt;input type="text" id="inputTag" name="inputTag" value="" onblur="this.value=this.value.toUpperCase()"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>  &lt;tr&gt;
      &lt;th&gt;Model:&lt;/th&gt;
      &lt;th&gt;
         &lt;input type="text" id="inputModel" name="inputModel" value=""&gt; 
         &lt;a href="#" id="updateBtn"&gt;Populate&lt;/a&gt;
         &lt;div id="spinner"&gt;
            &lt;img src="\images\ajax-load.gif" alt="Loading..."/&gt;
         &lt;/div&gt;
      &lt;/th&gt;
    &lt;/tr&gt;
  
  
   &lt;script type="text/javascript" src="\js\jquery-latest.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt; 
   $('#updateBtn').click( function(e) {
      //to disable the click from going to next page
      e.preventDefault();
      $.ajax({
         url: "modcreate.php",
         data: { 'txt1': $('#inputTag').val() },
         success: function(data) {
         }
      });
   });
   &lt;/script&gt;
  </code></pre>
  
  <p>modcreate.php</p>
  
  <pre><code>&lt;?php 
  
  $field1value = $_GET['txt1'];
      $file_string = file_get_contents('blahblah.com/'.$field1value);
      preg_match("/&lt;title&gt;Product Support for (.+)\| Dell/i", $file_string, $matches);
      $print = "$matches[1]";
      echo $print;
  ?&gt;
  </code></pre>
  
  <p>******Solution******
  my ajax call was missing the part where it sent the data back to the form field</p>
  
  <p>here is what the working ajax looks like now  thanks guys for all the pointers</p>
  
  <pre><code> &lt;script type="text/javascript" src="\js\jquery-latest.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt; 
   $('#updateBtn').click(function(e){
       //to disable the click from going to next page
       e.preventDefault();
       $.ajax({
           url: "modcreate.php",
           data: { 'txt1': $('#inputTag').val() },
           success: function(data) {
              $('#inputModel').val(data); //this was the missing part
           }
       });
   });
  &lt;/script&gt;
  </code></pre>