Wondering why it doesn’t load on one click, but on two………………………………………………………..?
<input id="btnPaymentAdd" type="button" value="Add Payment Info" />
</p>
<div id="paymentSection"></div>
<br />
....
$("#btnPaymentAdd").click(function () {
$("#paymentSection").load('/Donation/AddPaymentInfo');
$("#paymentSection").show('slow');
});
....
public ActionResult AddPaymentInfo()
{
var vModel = new PaymentViewModel();
vModel.Payment = new Payments();
vModel.PaymentType = new WCCDentalApp.Models.PaymentType();
ViewBag.PaymentTypes = new SelectList(dbEntities.PaymentTypes.OrderBy(pt => pt.PaymentTypeID),
"PaymentTypeID", "PaymentType1", vModel.Payment.PaymentTypeID);
return PartialView("PaymentPView", vModel);
}
You need to bind your
.show()function after the page loads…or you can use
.get(), like this:Otherwise, the way you have it will just do the
.show()without waiting for the page to load, will make you think like clicking it twice works.