lundi 21 décembre 2015

405 error from an IFrame

I have a main application and in one of the views I load an IFrame.
The IFrame is another controller/view that will make up this IFRAME
In the IFrame view I am trying to make an AJAX POST back to it's controller.
However I am getting a 405 error message on the post.

Is it possible to make a post back to the IFRAME controller?

Example: JavaScript from IFRAME:

function myFuction() {
    var model = {
        rId: 1,
        tId: 2,
        mType: 1
    };
    $.ajax({
        type: 'POST',
        url: 'Main/Report/GetData',
        contentType: 'application/json',
        data: JSON.stringify(model)
    }).success(callback);    
};

In the controller for the IFRAME:

[HttpPost]
public JsonResult GetMapDataT(int reportId, int targetId, int mapType)
{
    var userId = GetUserGuid();
    var data = MappingService.GetMapData(userId, reportId, targetId, mapType);
    return Json(data);
}

Aucun commentaire:

Enregistrer un commentaire