我想在JavaScript中使用XMLHttpRequest发送一些数据.
假设我在HTML中有以下表单:
<form name="inputform" action="somewhere" method="post">
<input type="hidden" value="person" name="user">
<input type="hidden" value="password" name="pwd">
<input type="hidden" value="place" name="organization">
<input type="hidden" value="key" name="requiredkey">
</form>
Run Code Online (Sandbox Code Playgroud)
如何在JavaScript中使用XMLHttpRequest编写等效代码?
这个问题没有完全回答,请免费提供!
我正在尝试在progress bar提交大型表单时显示简单的内容.
该表单包含十几个字段,以及一些文件上载字段,用户可以在其中选择图片.然后,当他点击Create按钮时,将提交包含数据和图片的表单,并在DB中创建实体.(只需点击一下即可提交表格和图片).
一切正常,但我想在提交过程中显示进度条.
我找到了很多解释如何显示进度条的教程,但我没有找到任何人解释如何显示进度条,表明方法完成的工作百分比,即我希望看到10%, 25%等...在提交过程中.
所以,基本上,这就是我所做的:(这是一个ASP.NET MVC3项目)
@model MyModel
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "target-form", enctype = "multipart/form-data" }))
{
//some Html.TextBoxFor() and other @Html.DropDownListFor
@Html.TextBoxFor(m => m.File, new { type = "file"})
<input type="submit" value="Create" class="submitButton" />
<div id="progressBar"></div>
}
Run Code Online (Sandbox Code Playgroud)
和一个基本的控制器
[HttpPost]
public ActionResult Create(MyModel model)
{
if (ModelState.IsValid)
{
DALLayer dal = new DALLayer()
dal.AddEntity(model);
return RedirectToAction("Index", "Home");
}
return null;
}
Run Code Online (Sandbox Code Playgroud)
是否有可能<div>在 …