using (Ajax.BeginForm("Action", "Controller", new AjaxOptions() { OnBegin = "alert('Replace with validation logic.')" }))
<div class="cart"> @Ajax.ActionLink("Add To Cart", "AddToCart", new { productId = Model.productId }, new AjaxOptions() { HttpMethod = "Post" }); </div>
@using (Ajax.BeginForm("Create", null, new AjaxOptions() { HttpMethod = "POST" }, new { id = "tab0" })) { <div id="tab0"> <input id="tab0Value" name="tab0Value" type="hidden" value=""> This is Tab 0 </div> }
@using (Ajax.BeginForm("CreateBuildingBlock", "Assumptions", null, new AjaxOptions { HttpMethod = "POST", OnSuccess = "postSuccess", OnFailure = "postFailed" }, new { enctype = "multipart/form-data" })) { // your form fields here } <script> function postSuccess() { // handle success here } function postfailed() { // handle failed post here } </script>
@using (Html.BeginForm("SData","Crawl", new AjaxOptions() { LoadingElementId="myLoadingElement" })) { // form }
@using (Ajax.BeginForm("Save", "Company", new AjaxOptions() { HttpMethod="Post", OnSuccess="onSuccess" }, new { id = "companyEditForm" })) { ....some edit fields...... <button type="submit" name="btn" value="save_next">Save & Next</button> <button type="submit" name="btn" value="save">Save</button> }
@using(Ajax.BeginForm("Action", "Controller", new {@param1 = "aaa", @param2 = "bbb"}, new AjaxOptions(){HttpMethod = "Post", UpdateTargetId = "#section1"})){ <div id="#section1"> ..... put your form controls here . . . </div> }
Ajax.BeginForm("Edit","Cars", null, new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "Post", OnSuccess = "updateSuccess" }, new { id = "updateCarForm" }) { /* Razor code */ }
@using (Ajax.BeginForm("YourAction", "YourController", new AjaxOptions() { HttpMethod = "POST" }, new { enctype = "multipart/form-data"})) { @Html.AntiForgeryToken() <input type="file" name="files"><br> <input type="submit" value="Upload File to Server"> }
@using (Ajax.BeginForm("Save", new AjaxOptions() { ... }) { .... }
@using (Ajax.BeginForm("UploadTrainingMedia", "CreateTest", new AjaxOptions() { HttpMethod = "POST", OnComplete = "displayUploadMediaMsg" }, new { enctype = "multipart/form-data", id = "frmUploadTrainingMedia" })) { ... html for form }
@using (Ajax.BeginForm("RemoveExisting", new AjaxOptions() { HttpMethod = "POST", OnBegin = "OptionalJSFunction", OnFailure = "OptionalJSFunction", OnSuccess = "OptionalJSFunction", UpdateTargetId = "targetId" })) { //Your form goes in here.. } <div id="targetId"> </div>
@Ajax.ActionLink("Select", "AssignSpeaker", new { conferenceId = ViewBag.ConferenceId, sessionId = session.Id }, new AjaxOptions() { HttpMethod="Get", InsertionMode= InsertionMode.Replace, UpdateTargetId="yourTarget", OnSuccess="fromPartial" })
$.ajax(new AjaxOptions().url("http://www.example.com") .type("POST") .dataType("json") .data("data to post") .cookies($.map($.entry("key", "value"))));
<div id="divTabPortfolio"> @using (Ajax.BeginForm("SomeAction", "YourController", new { id = optionalParameters }, new AjaxOptions() { HttpMethod = "Post", UpdateTargetId = "divTabPortfolio" })) { } </div>
@using (Ajax.BeginForm("ShowPartial", new AjaxOptions() { InsertionMode = InsertionMode.Replace, UpdateTargetId = "dane" })) { <input type="submit" value="click"/> } <div id="dane"> @Html.Action("ShowPartial") </div>
$.with(this, R.id.myshowbutton).click(new Function() { @Override public void invoke($ d, Object... args) { $.ajax(new AjaxOptions().url("http://www.cheesejedi.com/rest_services/get_big_cheese?level=1").success(new Function() { @Override public void invoke($ d, Object... args) { $.with(MyActivity.this, R.id.editText).text(args[0].toString()); } })); } });
public static AjaxOptions buildEventOptions(FacesContext facesContext, UIComponent component) { AjaxOptions ajaxOptions = new AjaxOptions(); appendComponentOptions(facesContext, component, ajaxOptions); Map<String, Object> parametersMap = RENDERER_UTILS.createParametersMap(facesContext, component); ajaxOptions.addParameters(parametersMap); return ajaxOptions; }
public static AjaxOptions buildEventOptions(FacesContext facesContext, UIComponent component) { AjaxOptions ajaxOptions = new AjaxOptions(); appendComponentOptions(facesContext, component, ajaxOptions); Map<String, Object> parametersMap = RENDERER_UTILS.createParametersMap(facesContext, component); ajaxOptions.addParameters(parametersMap); return ajaxOptions; }
public static AjaxOptions buildEventOptions(FacesContext facesContext, UIComponent component) { AjaxOptions ajaxOptions = new AjaxOptions(); appendComponentOptions(facesContext, component, ajaxOptions); Map<String, Object> parametersMap = RENDERER_UTILS.createParametersMap(facesContext, component); ajaxOptions.addParameters(parametersMap); if (component instanceof BasicActionComponent) { if (((BasicActionComponent) component).isResetValues()) { ajaxOptions.setParameter(AjaxConstants.RESET_VALUES_PARAMETER, true); } } return ajaxOptions; }