小编Rob*_*Rob的帖子

通过Ajax发布到MVC控制器

嗨我目前正在尝试使用AJAX发布一个控制器的表单但是到目前为止我没有运气,我一直试图让表单将表单中的值提交给控制器提交表单但是,任何人都知道为什么不行?:

CSHTML:

@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Abintegro Search Prototype</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <script>
        $("#submitsearch").click(function (e) {
            e.preventDefault();
            var form = $("#searchform");
            $.ajax({
                url: "Search/GetSearchDetails",
                data: form.serialize(),
                type: 'POST',
                success: function (data) {
                    //Show popup
                    $("#popup").html(data);
                }
            });
        });
</script>

    <!-- Javascript function to add autocomplete search phrases for the company name text search-->
    <script>
        $(function () {
            var searchPhrases = [
                "Zep Solutions",
                "Wetherby Consultants Ltd",
                "Webmploy", …
Run Code Online (Sandbox Code Playgroud)

c# ajax model-view-controller jquery visual-studio

5
推荐指数
1
解决办法
1072
查看次数

标签 统计

ajax ×1

c# ×1

jquery ×1

model-view-controller ×1

visual-studio ×1