0
我想補充圖像,當我點擊capthca。我怎樣才能做到這一點?asp.net mvc jquery填充圖像
public ActionResult Image()
{
var builder = new XCaptcha.ImageBuilder();
var result = builder.Create();
Session.Add("Cap", result.Solution);
return new FileContentResult(result.Image, result.ContentType);
}
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#images').click(function() {
$.ajax({
url: "/en/form/Image",
success: function (mydata) {
$("#images").attr("src", mydata);
},
type: "POST"
});
return false;
});
});
<input type="image" id="images" src="<%= Url.Action("Image", "ContactForms") %>"
alt="Click to refresh" /> <input type="text" size="5" tabindex="1000" dir="ltr" maxlength="5" name="Captcha" id="Captcha" />