引号无效

时间:2015-08-13 23:00:49

标签: swift

我不知道如何使用它:

$('#submit_bulk').on('click',function(e){

    var action = $('select[name="bulk_action"]'),
    targets = $('table tr td:first-child :checkbox:checked');
    if(action=='invalid' || targets.length == 0){
        sk.alert('Nothing to do','warning');
        return false;
    }else{
        $(this).html('Working....');

        var fData = {
            action: action,
            mixtapes: '',
            singles: ''
        };

        $.each(targets,function(i,v){
            if($(this).data('type') == 'mixtape'){
                fData.mixtapes += $(this).data('id')+',';
            }else{
                fData.singles += $(this).data('id')+',';
            }
        });

        fData = $.param(fData); 

        console.log(fData); //i get no output here. is fData null?

        $.post(window.location.origin+'/adminAPI/bulk_action',fData,function(data){
            var data = JSON.parse(data);
            if(data.error==0){
                sk.alert('Your changes were saved','success');
                //update view here.
            }else{
                sk.alert(data.message,'error');
            }
        });
        $(this).html('go');
    }

});

有了这个:

"\(something)"

就像那样:

"\(otherthing)"

但引号不能正确起作用。

2 个答案:

答案 0 :(得分:1)

Avt的答案非常正确,但是代码不好看。我的建议是您应该分离代码的元素:

let questionIndex = myQuestions.indexOfObject("\(myQuestions.new)")
let selectedAnswer = myAnswers[questionIndex][0]
botaoA.setTitle(selectedAnswer, forState: UIControlState.Normal)

答案 1 :(得分:0)

难以猜测,但我认为你需要

botaoA.setTitle("\(myAnswers[myQuestions.indexOfObject(myQuestions.new)][0])", forState: UIControlState.Normal)
相关问题