首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何保存Ajax角度的权值?

如何保存Ajax角度的权值?
EN

Stack Overflow用户
提问于 2015-07-13 01:53:08
回答 1查看 252关注 0票数 1

我在使用角AJAX在数据库中保存CKEDITOR值时遇到了问题。我不知道是角度问题还是PHP问题。顺便说一下,我在我的应用程序中使用了CodeIgniter 3。

下面是我的一些代码--我希望你能理解我所拥有的:

我的CKEDITOR:我在这里保留一份协议

以下是AJAX的保存:

代码语言:javascript
运行
复制
$scope.saveContent = function() {

    $scope.totals = [{
        'subtotals' : computeGrandTotal(),
        'vat_rate'  : quoteList.vat_rate,
        'grandtotal': computePercentage()
    }];

    $http({
        url: "<?php echo base_url('index.php/tutorial/submitQuotation'); ?>",
        method: 'POST',
        data: $.param({ 
                quotation: $scope.quoteHeader.items, 
                msc: quoteList, //here goes the agreeement content
                totals: $scope.totals 
            }),
        headers: {'Content-Type': 'application/x-www-form-urlencoded'}
    }).success(function(data){
        alert('Data successfully inserted!');
    }).error(function(){
        alert('Error Occured!');
    });

}

在我的模型中,我这样做:

代码语言:javascript
运行
复制
$sqlInsertQuotationAgreement = "INSERT INTO quotation_agreement SET quoatation_id = " . (int)$quotationID . ", agreement = '" . $agreement . "'";
$queryInsertQuotationAgreement = $this->db->query($sqlInsertQuotationAgreement);

当我检查我的开发人员控制台时,我得到了一个错误,因为我的CKEDITOR的值是用HTML而不是在代码中呈现的。

我尝试使用strip斜杠()和$this->db->转义(),但仍然出错。

你能帮我做这个吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-13 02:35:17

好的,我解决了我的错误。以下是我在查询中所做的工作:

代码语言:javascript
运行
复制
$sqlInsertQuotationAgreement = "INSERT INTO quotation_agreement SET quotation_id = " . (int)$quotationID . ", agreement = \"" . htmlspecialchars($agreement) . "\"";
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31374422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档