In my blade I use an ajax call to call a route. In my controller I am returning a different view. However, the view does not change. I am wondering if I need to change the view differently because I am using an ajax call that needs a return of success or not.
Here is my ajax code in my blade
$('#btnAnalyze').click(function(){
var text = $('#cv').val();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
type: 'POST',
url: "/widget/measurableresults",
data: {
text: text,
},
success: function (msg) {
console.log("Success");
},
error: function (msg) {
console.log(msg);
}
});
});
Here is my route
Route::post('/widget/measurableresults', 'WidgetController@measurableresults');
Here the method in my controller
public function measurableresults()
{
$text = Input::get('text');
Log::debug( $text );
return view('results.measurableresults');
}
The Log::debug prints out the value of $text and the ajax call returns success. However, the view does not change to results.measurableresults. What am I missing?