Hello,
This is Laravel.
After inputting the profile_info I wonder why after checking the dd($here) the result remains the same. I expect it to change the same just like the value that I input.
setting.blade.php
<div class="setting-box profile-open">
<form role="form" id="form_update_profile_info" method="post" action="{{action('AjaxController@postUpdateprofileInfo')}}">
<div class="form-group">
<div class="col-group">
<textarea style="height: 150px;" class="form-control" id="profile_info" name="profile_info">{{ $user_setting->info_profile }}</textarea>
</div>
</div>
</form>
</div>
...
$(".setting-nav-save").click(function(e){
e.preventDefault();
var profile_info = $("#profile_info").val();
$.ajax({
type: "POST",
url: '{{action("AjaxController@postUpdateprofileInfo")}}',
dataType : "text",
data : {
profile_info : profile_info,
},
success: function (response) {
if (response!="error") {
$("div.profile").show();
$(".setting-nav-save").hide();
$(".setting-nav-cancel").hide();
$(".setting-nav-edit").show();
$("div.profile-open").hide();
response = response.replace('"',' ');
response = response.replace('"','');
response = response.replace("\u00A0", " ").replace(/[\r\n]+/g, "\n");
$("div.profile").html(response);
pesanOk("success update profile info");
}else{
pesanErr("Oops try again");
}
}
});
});
AjaxController.php
public function postUpdateprofileInfo(Request $request)
{
$domain = $_SERVER['SERVER_NAME'];
$user = User::where('domain', $domain)->first();
$here = $request->input("profile_info");
dd($here);
if ($user) {
$user_setting = Setting::where('user_id', $user->id)->first();
$user_setting->info_profile = $request->input("profile_info");
$act = $user_setting->save();
if (!$act) {
$message = "error";
} else {
$message = \Soulfy\Timeline::split_words($request->input("profile_info"), 2000, "...");
}
return response()->json($message);
}
}