-1

k,我知道了,所以我再次检查并发现了我缺少的有趣的东西:javascript:

function my_tmpDropFunc(ddObj, targetObj ,doll)
{
    if(isDropTarget(targetObj, ddObj) || confirmed)
    {
        var typeTarget = getPositionType(targetObj.id);
        var typeDD = getPositionType(ddObj.id);

        // Item-Types to Confirm using
        toConfirm = new Array();
        //toConfirm.push(new Array(32768, 'confirmCostume'));

        //Itembox
        if (typeTarget == 384)
        {
            onDropOnItembox(ddObj, targetObj)
            return "break";
        }

        if (typeDD == 384 && onDropFromItembox(ddObj, targetObj))
            return "break";

        //Essen
        if(typeTarget == 8)
        {
            ddObj.moveTo(pickObj.x, pickObj.y);
            SwapBlockingfields(false);
            changeShow();
            SetToolTip(true);
            PICK_ITEM = false;

            // Gurt, Style
            if(ddObj.contenttype == 64 || ddObj.contenttype == 32768)
            {
                // If a Confirmation needed, not confirmed an the type requires a confirmation...
                if (confirmNeeded && !confirmed && in_multi_array(toConfirm, ddObj.contenttype))
                {
                    // Get the correct BlackOutDialogBox (Defined in array).
                    for (key in toConfirm)
                    {
                        if (ddObj.contenttype == toConfirm[key][0])
                        {
                            blackOutDialogBoxToUse = toConfirm[key][1];
                            if (showUseItemAlarm(ddObj,targetObj,typeTarget,doll,typeDD,blackOutDialogBoxToUse))
                                return "return";
                        }
                    }
                }

                //Verbrauchen
                dd.elements[ddObj.name].hide();
                targetObj.div.style.cursor = 'wait';
                changeDraggable(false);
                ddObj.moveTo(pickObj.x, pickObj.y);
                doll = document.getElementById('plDoll').value;
                sendRequest('get', 'ajax.php', 'mod=overview&submod=useItem&item='+ ddObj.id +'&doll='+doll);
            }
            return "return";
        }

        //Crafting
        if (checkCrafting(ddObj,targetObj,typeDD,typeTarget))
            return "return";

        //Enchanten
        if (targetObj.iid && typeTarget < 256 && !ddObj.enchanttype)
            return "continue";
        if (checkEnchant(ddObj, targetObj, typeTarget))
            return "return";

        //Ins Inventar
        if (typeTarget >= 512)
        {
            x = getPositionX(targetObj.id)-1;
            y = getPositionY(targetObj.id)-1;
            field = CalcFieldWithObj(ddObj, typeTarget, maxcols, maxrows);
            if(!(field[x][y] & ddObj.contentsize))
                return "continue";
        }

        if(!(targetObj.contenttypeaccept & ddObj.contenttype))
            return "continue";

        //Bestätigung bevor Item Seelengebunden wird.
        if (showUniqueItemAlarm(ddObj,targetObj,typeTarget,doll,typeDD))
            return "return";

        my_SwapContent (targetObj,ddObj);
        newXY(targetObj);
        newXY(ddObj);
        if(typeTarget < 256)
            reformEquiped(targetObj, targetObj.w, targetObj.h, true);
        else if(typeDD < 256)
        {
            reformEquiped(ddObj,targetObj.w, targetObj.h, false);
            ddObj.contentsize = ddObj.contentsizebase;
            newXY(dd.obj);
        }
        targetObj.maximizeZ();
        //aElts[i].div.style.zindex = 200;

        // Pruefen ob von Lager verschoben wird
        var from = ddObj.id.substring(1, 4);
        var storage = false;
        if (from >= 352 &&  from <= 357)
            storage = true;
        if (storage)
            sendRequest('get', 'ajax/guildstorageswap.php', 'old='+ ddObj.id +'&new='+targetObj.id+'&doll='+doll);
        else
            sendRequest('get', 'ajax/inventoryswap.php', 'old='+ ddObj.id +'&new='+targetObj.id+'&doll='+doll);
        tt_Init(1);
        return "break";
    }
}

正如您所看到的,“Reflic”建议它将数据发送到 ajax,所以在 ajax.php 中我需要创建什么来接收该数据它发送什么?

4

2 回答 2

1

调查json_encode。例子:

var myJSvariable = <?php echo json_encode($myPHPvariable); ?>;

这适用于任何类型的 PHP 变量,不包括资源。

于 2013-03-19T16:37:58.253 回答
1

使用 AJAX 通过 JavaScript 将请求发送到PHP脚本。 http://api.jquery.com/category/ajax/ - http://api.jquery.com/jQuery.ajax/

编辑:当然使用 JSON 格式。

于 2013-03-19T16:38:00.767 回答