小编Che*_*esi的帖子

javascript:string.replace无法正常工作

我在替换javascript / jquery中的字符串时遇到了一个小问题。首先代码:

HTML:

<fieldset>
    <legend>Contact persons</legend>
    <div id="cm_contactPersons">
        <fieldset id="cm_%email%">
            <legend><span class="glyphicon glyphicon-circle-arrow-right"></span> %email%</legend>
            <div class="form-group">
                <label for="cm_%email_inputFirstname" class="col-sm-2 control-label">Firstname</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="cm_%email%_inputFirstname" value="%firstname%" placeholder="" required>
                </div>
            </div>
            <div class="form-group">
                <label for="cm_%email%_inputLastname" class="col-sm-2 control-label">Lastname</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="cm_%email%_inputLastname" value="%lastname%" placeholder="i. e. Max" required>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">Actions</label>
                <div class="col-sm-10">
                    <button type="button" class="btn btn-warning">Create new password</button>
                    <button type="button" class="btn btn-danger">Delete contact person</button>
                </div>
            </div>
        </fieldset>
    </div>
</fieldset>
Run Code Online (Sandbox Code Playgroud)

Javascript:

$(document).ready(function() {
    $('#cm_customerList').btsListFilter('#cm_customerSearchInput');
    var …
Run Code Online (Sandbox Code Playgroud)

javascript string jquery replace

5
推荐指数
1
解决办法
3440
查看次数

C++/Qt - 可选参数默认为NULL

几周前,我在基于C++和Qt的Windows笔记本上写了一个小JSON-RPC实现.我使用Visual C++ 2013编译器,它没有任何问题.

现在我将我的代码复制到带有GCC编译器的Linux Mint机器上,我总是得到以下错误:

jsonrpc.h:18: Error: conversion from 'long int' to 'QJsonValue' is ambiguous
     static QJsonObject generateErrorObj(ErrorCode code, QString message, QJsonValue data = NULL);
Run Code Online (Sandbox Code Playgroud)

此错误也出现在第19行(方法generateErrorResponse)和第20行(方法generateRequest).所以...现在我不熟悉C++或Qt,所以我不明白,为什么这不起作用,虽然它在Windows上运行...

这是jsonrpc.h的完整代码:

#ifndef JSONRPC_H
#define JSONRPC_H

#include <QtCore>

class JSONRPC
{
public:
    enum ErrorCode
    {
        PARSE_ERROR = -32700,
        INVALID_REQUEST = -32600,
        METHOD_NOT_FOUND = -32601,
        INVALID_PARAMS = -32602,
        INTERNAL_ERROR = -32603
    };
    static QJsonObject generateObj(QString id, bool isNotification = false);
    static QJsonObject generateErrorObj(ErrorCode code, QString message, QJsonValue data = NULL);
    static QJsonObject generateErrorResponse(QString id, ErrorCode code, …
Run Code Online (Sandbox Code Playgroud)

c++ linux qt gcc

3
推荐指数
1
解决办法
681
查看次数

标签 统计

c++ ×1

gcc ×1

javascript ×1

jquery ×1

linux ×1

qt ×1

replace ×1

string ×1