I'm trying to make an ajax request from my homepage in Laravel. But I am unable to figure out what resource to request for. Can someone point me in the right direction? Thanks!!
My HTML:
<input name="login" id="login" type="button" value="Log In" class="flat-button" onclick="getLoginForm();" />
<input name="signup" id="signup" type="button" value="Sign Up" class="flat-button" onclick="getSignUpForm();" />
My JS:
function getLoginForm() {
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState==4&&xmlhttp.status==200) {
document.getElementById("modal").innerHTML=xmlhttp.responseText;
document.getElementById("modal").style.visibility="visible";
}
}
xmlhttp.open("GET","/showLoginForm",true);
xmlhttp.send();
}
And My Laravel Route:
Route::get('/showLoginForm', 'PowerUserController@showLoginForm');