Multiple task in one page?(php - mysql - jquery)

Posted by python on Stack Overflow See other posts from Stack Overflow or by python
Published on 2010-03-22T10:03:56Z Indexed on 2010/03/24 3:13 UTC
Read the original article Hit count: 239

Filed under:

My goal is to build an application in a page that can be use multiple task(crud)

for example in this html code.there are multiple submit,multiple action in the same page after (user submit (CURD) it will load result table below.)

In juery how Can I do this.?

<script type="text/javascript" src="jquery.js"></script>
<script>
    $(document).ready(function(){

    $("#button1").click(function(){
    $('form#crudform').attr({action: "script_1.php"});
    $('form#crudform').submit();
    });

    $("#button2").click(function(){
    $('form#crudform').attr({action: "script_2.php"});
    $('form#crudform').submit();
    });

    $("#button3").click(function(){
    $('form#crudform').attr({action: "script_3.php"});
    $('form#crudform').submit();
    });

    });
</script>
Form CRUD:
<form id="crudform" method="post">
<p>Name: <input type="text" name="name"/></p>
<p>Age: <input type="text" name="age"/></p>
<input type="button" id="button1" value="Cancel" />
<input type="button" id="button2" value="Save" />
<input type="button" id="button3" value="Update" />
</form>

Result:
<form id="result" method="post">
<table border="1">
<tr>
<tr><td></td><td>Name</td><td>Age</td>
</tr>
<tr><td><input type="checkbox" name="name1"></td><td>Name1</td><td>10</td><tr>
<tr><td><input type="checkbox" name="name1"></td><td>Name2</td><td>15</td></tr>
<tr><td><input type="checkbox" name="name3"></td><td>Name3</td><td>16</td></tr>
</table>
<input type="button" id="button4" value="change" />
<input type="button" id="button5" value="drop" />
</form>

Anybody know the tutorials relating ..with my tasks.or tips,guide.....are welconme :)

© Stack Overflow or respective owner

Related posts about jquery-ajax