How can I perform two actions when I click a button

I have a page with some input fields and a table and three buttons, pause, stop, respectively. I want to update part of the table only when I click the play button. I want the play button to do two things to start a refresh request and reload the page. I, when I press the pause button, I want to stop the table reload. And when I click the stop button, I want her to run the udate request. I am using codeigniter, an MVC architecture. This is what I tried and my browsing page.

<meta http-equiv="refresh" content="300">   
<input type="text" size="7" id="IC" name="IC" value="<?php echo set_value('IC',$IC); ?>" />
<input type="text" size="7" id="ID" name="ID" value="<?php echo set_value('ID',$ID); ?>" />
<button type="button" style="width:100px;">PLAY</button>
<button type="button" style="width:100px;">PAUSE</button>
<button type="button" style="width:100px;">STOP</button>
<table>
<tr>
<th> blah </th>
<th> blah </th>
<th> blah </th>
</tr>
//do some  code
</table>    
+3
source share
3 answers

You can call two js functions at a time at the click of a button. like a way ..

function jsfun1()
{
   //do the action here
}

function jsfun2()
{
   //do the action here
}

call both on onclick

<button type="button" style="width:100px;"  onclick="jsfun1(),jsfun2()">play</button>
+1
source

javascript.

2 onclick-action Button. onclick="playButton0(),playButton1()"

+1

You can use the jQuery framework to complete all of these tasks.

Blind function .clickfor each button and do things with function$.ajax

With the ajax function, you can send the values ​​to the controller you want and execute a request or something you need.

Additional Information:

http://api.jquery.com/click/

http://api.jquery.com/jquery.ajax/

+1
source

All Articles