7

Вопрос по asp.net-mvc, jquery – Вызов JQuery Ajax выдает ошибку 404 «Ресурс не найден», но нормальный URL-вызов в порядке

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

public class ViewRecordController: Controller
{
  public JSONResult GetSoftwareChoice(string username)
  {
     return Json(username);
  }
}

Error: User Rate Limit Exceeded

$(function() {
$("#username").click(function() {
        $.getJSON("ViewRecord/GetSoftwareChoice", {username:'123'},
    function(data) {
        alert(data);
    });
    });
});

Выше JQuery дает мне ошибку 404. ВидимоViewRecord/GetSoftwareChoice На сервере AJAX вызов не найден.

Но если я наберу это в моем веб-браузере:

http://myapp/ViewRecord/GetSoftwareChoice?username=123

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        "Default",                                              // Route name
        "{controller}/{action}/{id}",                           // URL with parameters
        new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
    );

}

Error: User Rate Limit ExceededViewRecord/GetSoftwareChoice?username=123.

Связанный вопрос:Error: User Rate Limit Exceeded

  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit ExceededmyappError: User Rate Limit Exceeded

    от Graviton
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от Graviton
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от Graviton
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от Graviton
  • Error: User Rate Limit Exceeded

    от
  • Error: User Rate Limit Exceeded

    от Graviton
7 ответов
  • 4

    Code:

    $(function() {
        $("#username").click(function() {
            $.getJSON('<%= Url.Action("GetSoftwareChoice", "ViewRecord")%>',{username: '123'}, function(data) {
                alert(data);
            });
        });
    });
    

  • 1

    Error: User Rate Limit Exceeded

    $(function() {
    $("#username").click(function() {
            $.getJSON("ViewRecord/GetSoftwareChoice", {username:'123'},
        function(data) {
            alert(data);
        });
        });
    });
    

  • 1

    Error: User Rate Limit Exceeded

    $.getJSON("ViewRecord/GetSoftwareChoice", {username='123'},
    

  • 5

    Error: User Rate Limit Exceeded

    http://localhost/ViewRecord/ViewRecord/GetSoftwareChoice?username=123
    

    $(function() {
    $("#username").click(function() {
            $.getJSON("ViewRecord/GetSoftwareChoice", {username:'123'},
        function(data) {
            alert(data);
        });
        });
    });
    

    $.getJSON

    $.getJSON("GetSoftwareChoice", {username:'123'},
    

     $.getJSON("/ViewRecord/GetSoftwareChoice", {username:'123'},
    

  • 0

    Error: User Rate Limit Exceeded

    function Chart() {
    
        var url = "../Home/Pie/";
        $.ajax({
            url: url,
            data: {},
            cache: false,
            type: "POST",
            success: function (data) {
                var chartData = data;
                createChart(chartData);
                $(document).bind("kendo:skinChange", createChart);
            },
            error: function (xhr, status, error) {
                $('#alertdialog').html(status);
                $('#alertdialog').dialog('open');
                return false;
            }
        });
    }
    

    Answers : var url = "Home/Pie/

  • 0

    Error: User Rate Limit Exceeded

    Get_OrderLineinv_item_id

    // Update OrderLine data by returning a JSON result
    $('#itemsddl').click(function (e) {
        var selectedItem = $(this).val();
        var actionURL = "Get_OrderLine";
        var d = "inv_item_id=" + selectedItem;
        var uom = $('#uom');
        var size = $('#size');
        var unitLbs = $('#unitLbs');
        var totalLbs = $('#totalLbs');
        var shipName = $('#shipName');
        var hazardClass = $('#hazardClass');
        var unnaNo = $('#unnaNo');
        var packingGroup = $('#packingGroup');
        var placard = $('#placard');
        var ergNo = $('#ergNo');
        $.ajax({
            cache: false,
            type: 'GET',
            url: actionURL, 
            data: d,
            datatype: JSON,
            success: function (data) {
                uom.val(data.uom);
                size.val(data.size);
                unitLbs.val(data.unitLbs);
                totalLbs.val(data.totalLbs);
                shipName.val(data.shipName);
                hazardClass.val(data.hazardClass);
                unnaNo.val(data.unnaNo);
                packingGroup.val(data.packingGroup);
                placard.val(data.placard);
                ergNo.val(data.ergNo);
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert('Failed to query item - ' + thrownError + "\n" + "Full details: " + xhr.responseText);
            }
        });
        e.preventDefault();
    });
    

    public ActionResult Get_OrderLine(int? inv_item_id)
    {
        HazmatInfoItem item = new HazmatInfoItem();
        item.itemId = "0";
        item.size = "0";
        item.unitLbs = 0;
        item.qty = 0;
        item.totalLbs = item.qty * item.unitLbs;
        item.shipName = "";
        item.hazardClass = "";
        item.unnaNo = "";
        item.packingGroup = "";
        item.placard = "";
        item.ergNo = "";
    
        var items = from i in hazmatRepository.GetAllItems()
                    select i;
    
        // Get item details
        items = items.Where(i => i.INV_ITEM_ID.Contains(inv_item_id.ToString()));
    
        foreach (var i in items)
        {
            item.uom = i.UNIT_MEASURE_STD;
            item.size = i.INV_ITEM_SIZE;
            item.unitLbs = 1;
            item.totalLbs = item.unitLbs * item.qty;
            item.shipName = i.PAG_SHIPPING_NAME;
            item.hazardClass = i.HAZ_CLASS_CD;
            item.unnaNo = i.MSDS_ID;
            item.packingGroup = i.PACKING_CD;
            item.placard = i.PAG_PLACARD_TYPE;
        }
    
        return Json(item, JsonRequestBehavior.AllowGet);
    }
    

  • 8

    Error: User Rate Limit Exceeded

    $(function() {
        $("#username").click(function() {
            var url = '<%= UrlHelper.Action("GetSoftwareChoice", "ViewRecord") %>';
            $.getJSON(url, {username: '123'}, function(data) {
                alert(data);
            });
        });
    });