No Picture
JavaScript

[JavaScript] 如何配合JQuery做到Async submit

2016-03-16 C.H. Ling 0

在此例子中, 它override了本身form[0].submit()的方法, 再配合JQuery ajax(), 從而做到到async submit 的效果. $(‘#formDetails’).submit(function (e) { e.preventDefault(); //do some verification $.ajax({ url: “@Url.Action(“Save”,”Reservation”)”, method: “POST”, data: $(this).serialize(), success: function (data) { //callback methods go right here } }); });  

No Picture
JavaScript

[JavaScript] Function Parameter 預設值.

2016-03-10 C.H. Ling 0

部份programming language 寫function call 時可以支援default value, 可惜JavaScript不能. 故須要特別處理. function alertDialog(message, title, okCallBack) { message=typeof message !== ‘undefinded’? message: “”; title=typeof title!==’undefinded’? title: “Dialog”; okCallBack=typeof okCallBack!==’undefined’? okCallBack: function (dialogRef) { dialogRef.close(); }; BootstrapDialog.show({ title: title, message: […]

1 2