JelleP
JelleP

Reputation: 1004

Jquery Ajax url two times

I have an strange problem with Ajax.

var base_url = 'https//m4th.nl/'; // Alle groepen van deze school ophalen
$.ajax({
    type: "POST",
    async: false,
    url: base_url + "rapportage/get/groups/",
    success: function(data) {
        $.each($.parseJSON(data), function(i, item) {   
            $('select[name="leerling-groep"]').append('<option value="' + item.id + '">' + item.naam + '</option>');    
        });
    }
}); 

But in my console i get this error:

"NetworkError: 404 Not Found - https://m4th.nl/rapportage/https//m4th.nl/rapportage/get/groups/"

Very strange because input of the url is ok but the code duplicate the url.

Does somebody know what i did wrong?

Thanks!

Upvotes: 0

Views: 305

Answers (1)

Satya
Satya

Reputation: 8881

change this line

var base_url = 'https//m4th.nl/';

to

var base_url = 'https://m4th.nl/';

you are missing the colon after https making the browser to think of the base url as extension -url

Upvotes: 4

Related Questions