我们在变量中有html代码。我们想用
php
并保存在mysql中。
home.ts
侧码:
this.divCodesub = document.getElementById(this.selectedDivCodesub);
console.log (this.divCodesub);
数据输入控制台.log是:
<div id="0"><div id="change_color" class="heading-back context_menu"><div class="row"><div contenteditable="true" class="col-md-12 heading-sec context_menu">Hi there, Im <span contenteditable="true" class="head-clr">STACK</span></div><div contenteditable="true" class="col-md-12 heading-sec context_menu">Smart, simple and responsive.</div></div></div></div>
divCode:[对象HTMLDivElement]
,此消息出现在网络中。
我们怎么才能通过呢?
编辑:1
如何将变量发送到php,请参见下面的代码-
代码:
'divI='+this.list[this.selectedDivCodesub].div_id+'&divCode='+this.divCodesub;
this._updateSection.callService(api,params).subscribe(data=>{
...
});
service.ts
代码:
callService(api,params){
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
return this._http.post(this._url+api,params+"&"+this.randomno,{headers:headers})
.map((response:Response) => response.json());
}