Popping an alert when Getting Information
<p>How can i display an alert message or alert box when getting the information(not submitting)</p>

<p>i have few form structures(text type) in my html when i enter the <strong>id</strong> in one of the form and press get button all the other forms will be filled based on the form submitted.</p>

<p>for the above i am using json and jquery</p>

<p>Ex:</p>

<p>Jquery</p>

<pre><code>$(document).ready(function(){
$("#button1").click(function(){
$.post('script_1.php', { id: $('input[name="id"]', '#myForm').val() },
function(json) { 
$("input[name='title']").val(json.title);
$("input[name='name']").val(json.name); 
$("input[name='age']").val(json.age);
$("#institution").val(json.institution); 
}, "json");
 });
</code></pre>

<p>json:</p>

<pre><code> $abc_output = array('title' =&gt; $row['title'],'name' =&gt; $row['name'],'age' =&gt; $row['age'], 'institution' =&gt; $row['institution']);
 echo json_encode($abc_output);
</code></pre>

<p>now the problem is all the id's will not be having information so when the user enters some id with no information pop up or alert box need to be submitted saying no id.</p>

<p>How can i do that?</p>

<p>Note: as it is get info the result will be displayed on the same page, if its submit i could have echoed id not found in DB in the server side php(script_1.php) which is not the case here.</p>

<p>Html:</p>

<pre><code> id: &lt;input type="text" name="id"/&gt;
 &lt;div id="hidden" style="display: none;"&gt;
 &lt;p&gt;Title:&lt;input type="text" name="title"/&gt;&lt;/p&gt;
 &lt;p&gt;name:&lt;input type="text" name="rno"/&gt;&lt;/p&gt;
 &lt;p&gt;age:&lt;input type="text" name="age"/&gt;&lt;/p&gt;
  Institution: &lt;select id="institution" name="institution"&gt;
  &lt;option value="None"&gt;-- Select --&lt;/option&gt;
  &lt;option value="ab"&gt;ab&lt;/option&gt;
   &lt;option value="bc"&gt;bc&lt;/option&gt; 
   &lt;/select&gt;

  &lt;/div&gt;
  &lt;br/&gt; 
 &lt;input type="button" id="button1" value ="Get Info" onclick="document.getElementById('hidden').style.display = '';"/&gt; 

 &lt;/form&gt;
 &lt;div id="age"&gt;&lt;/div&gt;
 &lt;/body&gt;
 &lt;/html&gt;
</code></pre>
