weixin_33724059 2015-08-11 23:33 采纳率: 0%
浏览 4

Ajax发布停止工作

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号