Hi Marc,
I assume that this class will be added only if $cfg['AjaxEnable'] is true.
Yes.
I suggest going for #2, provided this is done via AJAX (only refresh the usersForm by obtaining the new list from a call to server_privileges.js).
So in server_privileges.php starting at line 2142, instead of using echo to generate the form, it would be gathered in a variable using a logic similar to the one in server_privileges.php starting at line 1357. Then it's either echoed if not coming from an ajax request, or sent via PMA_ajaxResponse().
I went through the process which you have mentioned above. I have replaced echo with collecting variable called $user_form and then handled the ajax_enabeled action as follows.
if($GLOBALS['is_ajax_request'] == true){ $extra_data['user_form'] = $user_form; $message = PMA_Message::success(__('New user has been added.')); PMA_ajaxResponse($message, $message->isSuccess(), $extra_data); }
And in my server_privileges.js file I have called the post method as follows. $testing_parameters = "db=super_store&server=1&token=c6ad5e8e3a8042287e401dc5e739280a&checkprivs=super_store&viewing_mode=db&ajax_request=true"; $.post( $form.attr('action'), $testing_parameters, function(mydata){ $("#usersForm").append(mydata); });
I have used hard coded parameters in $testing_parameters variable and the append the datafor $("#uerForm") for test the feature.
But the appended my data does not returns an json object. it just return a string containing the results. I have share screen shots of the alert and the UI which shows the returned $mydata string with this doc [1]. Can you help me on why this happens.
If I'm not going to use the PMA_ajaxResponse() method I can just take the whole post data and extract the new #usersForm out of that and repalace the old one.
Please help me on this issue. Thank you.
[1] - https://docs.google.com/document/d/1DLcwm4VJv-IrLBiwlRwFPs4oaSuC_bPOsxrJ99xW...
Regards, Thilanka.