In jquery
$('#myview').val("view");
In html
<input type="hidden" name="myview" id="myview" class="form-control" autocomplete="off" />
In jquery
$('#mysample_form').on('submit', function(event) {
console.log('mysample_form button click ho rha ha');
event.preventDefault();
console.log('update button pe click ho rha hai');
$.ajax({
url: "{{url('/api/v1/j/webaccess/update/') }}",
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
processData: false,
dataType: "json",
headers: {
"Authorization": "Bearer " + localStorage.getItem('a_u_a_b_t')
},
// message alert open
success: function(data) {
console.log('update ho gaya successfully');
// adding alert messages
const parsed = JSON.parse(JSON.stringify({data}));
console.log(parsed);
const myValue = parsed.data[website];
console.log(myValue);
$('#myformModal').modal('hide');
$.each(parsed, function(i, link) {
var task =link.type_task;
var view =link.myview;
console.log("mera task aata hain");
console.log(task);
if(task==null){
console.log("nuu l e aata hain");
$('#unpublish_Modal').modal('show');
}
else{
if(view=='view')
{
$('#type_of_task_view').html(link.type_task);
$('#website_view_details').html(link.website);
$('#email_address_view_details').html(link.email);
$('#user_name_view_details').html(link.username);
$('#password_view_details').html(link.password);
$('#maintenance_engineer_view_details').html(link.pro_engg);
$('#wizard_project_name_view_details').html(link.mytoken_engineer);
$('#key_name').html(link.mytoken_engineer);
$('.modal-title').text("webaccess_view_details");
$('.modal-title_delete').text("Assets Detail");
$('#action_button').val("Detail");
$('#action').val("Detail");
$('#webaccess_view_details').modal('show');///////1st modal
}
else{
$('#type_of_task').val(link.type_task);
$('#website').val(link.website);
$('#email_address').val(link.email);
$('#maintenance_engineer').val(link.pro_engg);
$('#password').val(link.password);
$('#user_name').val(link.username);
$('#wizard_project_name').val(link.pro_name);
$('#myeditid').val(link.myid);
$('#myeditid').val(link.myid);
$('#myeditid').val(link.myid);
$('#project_manager').val(link.pro_engg);
$('#token_manager').val(link.mytoken_engineer);
$('.modal-title').text("Edit Assets");
$('.modal-title_delete').text("Assets Delete");
$('#action_button').val("Update");
$('#action').val("Update");
$('#formModal').modal('show'); ////2nd modal
}
}
});
In Laravel
$myview=$input['myview'];
if($myview=="view")
{
$data = [
'mytoken_engineer' => $mytoken_engineer, 'myid' => $myid, 'website' => $Decrypted, 'u_org_role_id' => $u_org_role_id,'admin_id' => $admin_id,'u_org_slugname' => $u_org_slugname, 'u_org_organization_id' => $u_org_organization_id, 'admin_email' => $admin_email, 'username' => $Decrypted2, 'email' => $Decrypted1,'password' => $Decrypted3,'pro_name' => $Decrypted4,'pro_engg' => $Decrypted5,'myview' => $myview,'type_task' => $Decrypted6
];
return response()->json($data);
}
else{
$data = [
'mytoken_engineer' => $mytoken_engineer, 'myid' => $myid, 'website' => $Decrypted, 'u_org_role_id' => $u_org_role_id,'admin_id' => $admin_id,'u_org_slugname' => $u_org_slugname, 'u_org_organization_id' => $u_org_organization_id, 'admin_email' => $admin_email, 'username' => $Decrypted2, 'email' => $Decrypted1,'password' => $Decrypted3,'pro_name' => $Decrypted4,'pro_engg' => $Decrypted5,'type_task' => $Decrypted6
];
return response()->json($data);
}
Top comments (0)