简体   繁体   中英

another ways to receive an id without html

I'm just trying to get to the lower part of the variable "diemap" and have tried it by .unfortunately, is not

know one another possibility or somehow how I can integrate this as a var? thanks in advance

ps, the dates of mapname he gets by the client in which the page is bound times later so make you no thoughts.

http://i.stack.imgur.com/hw1LQ.png

its all written in a script.js and yeah that's the reason why I am searching for another way to transmitting the variable.

the code:

function GameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode ) {
    document.getElementById( "s-name" ).innerHTML = servername;
    document.getElementById( "s-mode" ).innerHTML = gamemode;
    document.getElementById( "diemap" ).innerHTML = mapname;
}

function getBackgrounds(weit, callback) {
    $.get("backgrounds/" + weit + "/1.jpg")
        .done(function () {
        callback(weit);
    })
    .fail(function () {
        callback('default');
    });
}

getBackgrounds( "<span id="diemap">unkow</span>" , function (response) 
{
    $('#ergebnis').html(response);
});

Not sure I get the question based on the grammar but your syntax is wrong on this line

getBackgrounds( "<span id="diemap">unkow</span>" , function (response) {

You need to either escape the double quotes or use single quotes around diemap

getBackgrounds( "<span id='diemap'>unkow</span>" , function (response) {

Escaping them:

getBackgrounds( "<span id=\\"diemap\\">unkow</span>" , function (response) {

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM