I have the following form inside the jquery UI and when i try to submit it, my alert is coming as empty
please guide why
my Form Page:
<form id="formcountry" class="icountry" name="formcountry">
<label>Country Name</label>
<input type="text" id="Country" class="input-block-level" name="Country" placeholder="Country Name">
<span class="help-block">Type Country Name as [USA, India, Canada].</span>
<label>Country Code</label>
<input type="text" id="countrycode" class="input-large" name="countrycode" placeholder="Country Code">
<label>Status</label>
<select name="status" id="status">
<option value="Yes">Visible</option>
<option value="No">Hidden</option>
</select>
<br>
<input type="button" class="btn submitcountry" name="submit" id="submit" value="Submit">
<input type="hidden" name="ID" value="1" id="ID" />
<input type="hidden" name="old_Country" value="" id="old_Country" />
</form>
Open in new window
my jquery UI Code
$('#ui-tabs-3').on('click','.submitcountry',function() {
var dataString = $("form").serialize();
alert(dataString);
$.ajax({
type:"POST",
url:"save.cfm?mode=countryadd",
cache:false,
data:dataString,
success:function(result) {
var i = $("#AddCountry").html(result);
alert(i);
}
});
});
Open in new window
i have the jquery ui is the 3rd tab, when i click submit. it is just showing me empty alert rather than a form values, please guide why it is wrong
Thanks
Open in new window
Seems like you are attaching a jquery command to a variable. Doesn't seem like that should work. Any js errors? Maybe you just want to do:
Open in new window