I'm trying to verify that certain fields in my form are numeric and not text. Where would I start ?
If the fields are numeric, then serialize, if not then send an empty string. The reason I want to do this is because PHP sees the data for each variable as a string and not numeric.
this is my ajax request
$.ajax({
type: "POST",
url: "lib/calc.php",
data: $("#calcQuery").serialize(),
dataType: "html",
success: function(response)
{
$("#calcBox").html(response);
$("#calcBox").show();
clearForm("#calcQuery");
},
this is my form
<form id="calcQuery" class="ui-widget-shadow ui-corner-all" style="margin-top: 1em;">
<fieldset class="ui-corner-all" >
<table border="0" width="85%">
<tr>
<th><nobr><label for="curr_alloc">Current Space Allocation:</label></nobr></th>
<td align="right"><input type="text" size="5" name="curr_alloc" id="curr_alloc" /></td>
</tr>
<tr>
<td>
<table border="0" style="margin-left: .5em;">
<tr>
<td>
<input type="radio" name="curr_unit" value="KB" /><label>KB</label>
</td>
</tr>
<tr>
<td>
<input type="radio" name="curr_unit" value="MB" /><label>MB</label>
</td>
</tr>
<tr>
<td>
<input type="radio" name="curr_unit" value="GB" checked /><label>GB</label>
</td>
</tr>
<tr>
<td>
<input type="radio" name="curr_unit" value="TB" /><label>TB</label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<th><nobr><label for="curr_percent">Current Usage Percentage:</label></nobr></th>
<td align="right"><input type="text" size="5" name="curr_percent" id="curr_percent" /></td>
</tr>
<tr>
<th><nobr><label for="desired_percent">Desired Usage Percentage:</label></nobr></th>
<td align="right"><input type="text" size="5" name="desired_percent" id="desired_percent" /></td>
</tr>
</table>
</fieldset>
</form>