Load some data from database and hide it somewhere in a web page

Posted by kwokwai on Stack Overflow See other posts from Stack Overflow or by kwokwai
Published on 2010-06-02T05:16:38Z Indexed on 2010/06/02 5:23 UTC
Read the original article Hit count: 216

Filed under:

Hi all,

I am trying to load some data (which may be up to a few thousands words) from the database,
and store the data somewhere in a html web page for comparing the data input by users.

I am thinking to load the data to a Textarea under Div tag and hide the the data:

<Div id="reference" style="Display:none;">
<textarea rows="2" cols="20" id="database">
html, htm, php, asp, jsp, aspx, ctp, thtml, xml, xsl...
</textarea>
</Div>

<table border=0 width="100%">
<tr>
    <td>Username</td>
    <td>       
        <div id="username">
    <input type="text" name="data" id="data">
    </div>       
        </td>
</tr>
</table>

<script>
$(document).ready(function(){
//comparing the data loaded from database with the user's input
if($("#data").val()==$("#database").val())
{alert("error");}
});
</script>

I am not sure if this is the best way to do it, so
could you give me some advice and suggest your methods please.

© Stack Overflow or respective owner

Related posts about jQuery