locked
How can I debug simple ajax call to Controller failure RRS feed

  • Question

  • User1868852945 posted

    My jquery ajax call below is always returning error.  First time ajax for me, I have followed the samples here but I cannot get successful call.  I did prove via debug that Controller is successfully returning a query result set, so the problem must be in the ajax call below.  Thanks for any help.

    $('.link_board_filter_image').click(function () {
    var dataObject = JSON.stringify({
    'p_db_type': $(this).data("db_type"),
    'p_sch': $(this).data("sch"),
    'p_own': $(this).data("own"),
    'p_env': $(this).data("env"),
    'p_object_type': $(this).data("object_type"),
    });
    alert("dataObject: " + dataObject);  // at runtime this looks perfect.

    $.ajax({
    type: 'POST',
    async: false,
    dataType: 'json',
    contentType: 'application/json',

    data: dataObject,

    success: function (data) {
    response($.map(data.d, function (item) {
    return { value: item }
    }))
    },
    error: function (result) {
    alert("Error: " + result.error);  //when runtime this result.error string is unhelpful (to me)
    }
    });
    });

    Saturday, August 19, 2017 12:05 AM

Answers

  • User1868852945 posted

    My mistake I had to add url to the ajax call:

    url: "/SchemaTree/get_filtered_link_board",

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, August 19, 2017 12:27 AM