Joshua Akande Joshua Akande - 11 months ago 59
Javascript Question

How to introduce a click event in ajax

this already works for onchange just for the input field only btu
i'm trying to make the ajax work when the search button is clicked
the url calls the php side which is in perfect condition

<script type="text/javascript">
function bn(val)
type: 'post',
url: 'salprefix.php',
data: {
success: function (response) {

<form method='post' action='#'>
<label for='name'>Name</label>
<input type='text' id='staffname' name='staffname' onchange='bn(this.value);'>
<td colspan='2'>
<input type='submit' id='submit' name='submit' value='Search'>
<div id = 'submitname'></div>

Answer Source
<input type='button' id='submit' name='submit' value='Search' onclick="bn(staffname.value)">

try this