Javascript ajax请求不使用jQuery发送任何数据ASP.NET MVC项目

Javascript ajax请求不使用jQuery发送任何数据ASP.NET MVC项目,javascript,jquery,asp.net,ajax,asp.net-mvc,Javascript,Jquery,Asp.net,Ajax,Asp.net Mvc,我对asp.net MVC还不太熟悉,但我不明白为什么我的请求不起作用 我正在尝试使用jquery发送ajax请求,如下所示: jQuery(function ($) { var total = 0, share = $('div.share'), googlePlusUrl = "https://plusone.google.com/_/+1/fastbutton?url=http://bookboon.com" + $(location).attr('

我对asp.net MVC还不太熟悉,但我不明白为什么我的请求不起作用

我正在尝试使用jquery发送ajax请求,如下所示:

jQuery(function ($) {
    var total = 0,
        share = $('div.share'),
        googlePlusUrl = "https://plusone.google.com/_/+1/fastbutton?url=http://bookboon.com" + $(location).attr('pathname');

    setTimeout(function() {
        $.ajax({
            type: 'GET',
            data: "smelly",
            traditional: true,
            url: share.data('proxy'),
            success: function(junk) {
                //var $junk = junk.match(regex);
                console.log(junk);
            },
            error: function (xhr, errorText) {
                console.log('Error ' + xhr.responseType);
            },
        });
    }, 4000);
并在我的RouteConfig中设置一行:

routes.MapRoute(null, "services/{site}/proxy", new { controller = "Recommendations", action = "Proxy" });
标记的数据属性值为:

<div class="share" data-proxy="@Url.Action("Proxy", "Recommendations")">
问题是
junk
参数始终为空。我可以在调试输出中看到,当页面加载时(根据jQuery的document ready函数),路由似乎正确地重定向到此方法,但我似乎无法发送任何数据

我尝试发送简单的数据(“臭”),但我也没有收到


任何建议,谢谢

模型绑定器将在名为
垃圾的请求中查找一个参数,但是您只发送一个普通字符串。试试这个:

$.ajax({
    type: 'GET',
    data: { junk: "smelly" }, // <- note the object here
    traditional: true,
    url: share.data('proxy'),
    success: function(junk) {
        //var $junk = junk.match(regex);
        console.log(junk);
    },
    error: function (xhr, errorText) {
        console.log('Error ' + xhr.responseType);
    },
});
$.ajax({
键入:“GET”,

资料:{垃圾:“臭烘烘的”},//反应敏捷,你费心纠正间隔..我的孩子都好吗,先生
$.ajax({
    type: 'GET',
    data: { junk: "smelly" }, // <- note the object here
    traditional: true,
    url: share.data('proxy'),
    success: function(junk) {
        //var $junk = junk.match(regex);
        console.log(junk);
    },
    error: function (xhr, errorText) {
        console.log('Error ' + xhr.responseType);
    },
});