Welcome Guest, Not a member yet? Register   Sign In
Getting Status Code: 307 Temporary Redirect with an ajax get request [SOLVED]
#1
Sad 
(This post was last modified: 12-19-2019, 12:56 PM by Nilheim. Edit Reason: The problem was solved )

Hello, can someone help? Why do I get a temporary redirect status code when I try to make a get request type in an ajax call?

I'm working in this JS code:

Code:
$('#menu').on('click', 'a', function (event) {
    event.preventDefault();
    if ($(this).attr('href') !== '#') {
        var meta = $("meta[name='database-id']").attr("content");
        var ventana = $('#ventana');
        $.ajax({
            method: 'GET',
            url: $(this).attr('href')
            //data: {'btn': 'na-ver'}
            //dataType: 'json'
        })
        .done(function(data) {
            if (data) {
                ventana.hide();
                ventana.promise().done(function () {
                    ventana.html(data.responseText);
                });
                ventana.fadeIn();
            }
        })
        .fail(function(data) {
            if (data.status === 200) {
                ventana.hide();
                ventana.promise().done(function () {
                    ventana.html(data.responseText);
                });
                ventana.fadeIn();
            } else {
                if (data.responseJSON) {
                    App.respuesta(data.responseJSON);
                } else {
                    App.respuesta(data);
                }
            }
        });
    }
});


The url is well formed, I got this: "http://localhost.scbmk.pro/rol", wich is ok because I have a controller named "rol" and the default method is set to index in app config.

But trying to access to that url via get request doesn't work, it makes a temporary redirect. When accessing via post request the url works perfect, why is this? Do I need to make changes in app conf? remapping route? please heeeeeeeeelp  Cry

I'm working with CI version 4.0.0-rc.3
Reply


Messages In This Thread
Getting Status Code: 307 Temporary Redirect with an ajax get request [SOLVED] - by Nilheim - 12-17-2019, 09:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB