this script worked me a while ago, now does not work and I can not find the reason, I have seen my browser console and says nothing, here I leave the code:
HTML
<a id="convert_users" href="javascript:void(0);" class="button"><span>Convert</span></a>
<div id="loader"></div>
The Javascript
$(function(){
$('.button').click(function(){
var table = 'users';
var membersgroups = JSON.stringify({"from_1":"to_4","from_2":"to_0","from_3":"to_6","from_4":"to_1","from_5":"to_0","from_12":"to_15","from_11":"to_14","from_10":"to_13"});
var request = $.ajax({
url: "convert.php",
type: "POST",
data: {action : table, groups : membersgroups},
dataType: "html"
});
$('#loader').html("<img src="./extra/images/ajax_loader.gif" />");
request.done(function(msg) {
$('#loader').html("<img src="./extra/images/accept.png" />");
$('#list').html( msg );
});
request.fail(function(jqXHR, textStatus) {
$('#loader').html( "Error: " + textStatus );
});
});
});
PHP
<?php
$actions = array(
'users' => 'convertMembers',
'categories' => 'convertCats',
);
if(isset($_POST['action']))
call_user_func($actions[$_POST['action']]);
function convertMembers()
{
global $convert, $incontext, $txt;
global $INFO, $db_prefix;
//load the language
require_once(dirname(__FILE__) . '/languages/convert.' . $convert['lang'] . '.php');
//set ipb prefix
$from_prefix = $INFO['sql_tbl_prefix'];
//set smf prefix
$to_prefix = $db_prefix;
$membersgroups = json_decode(stripslashes($_POST['groups']));
echo var_dump($membersgroups);
}
?>
really i don't know why not working now, i search over the web and i can't any solution for this, can anyone help me?.
Regards.