Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is a working piece of code:</p> <pre><code>&lt;script type='text/javascript'&gt; function connect() { $.ajax({ url:'display.php', type: 'POST', dataType:'xml', success: { server: $('#server').val()||'None', username: $('#username').val()||'None', password: $('#password').val()||'None', database: $('#database').val()||'None', content: "tables" }, function(data){ $('#content').html('&lt;ul&gt;&lt;/ul&gt;'); var contentUL = $('#content&gt;ul'); $(data).find('table').each(function(){ $('&lt;li&gt;&lt;/li&gt;').html($(this).html()).appendTo(contentUL); }); }, 'xml' }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;div class='connection'&gt; &lt;form id="connectForm" name='connectForm'&gt; Server: &lt;input id="server" type='text' size='30' name='server' /&gt; Username: &lt;input id="username" type='text' name='username' /&gt; Password: &lt;input id="password" type='password' name='password' /&gt; Database: &lt;input id="database" type='text' name='database' /&gt; &lt;input type='button' onclick='connect();' value='Connect' /&gt; &lt;/form&gt; &lt;/div&gt; &lt;div id='content'&gt; &lt;/div&gt; &lt;/center&gt; &lt;/body&gt; </code></pre> <p>But in my opinion it's better and easier to use JSON instead of xml, it's more easier to work with it (last lines of get function):</p> <pre><code> function(data){ $('#content').html('&lt;ul&gt;&lt;/ul&gt;'); var contentUL = $('#content&gt;ul'); $.each(data.tables, function(){ $('&lt;li&gt;&lt;/li&gt;').html(this).appendTo(contentUL); }); }, 'json'); </code></pre> <p>Also you can use jquery.form plugin to submit a form. It also can update specified elements using response, example:</p> <pre><code>$(document).ready(function() { $('#connectForm').ajaxForm({ target: '#content' }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload