title: object HTMLDivElement coming while passing html code to php - Angular
body: <p><strong>Brief Description:</strong> We have html code in variable. We want to pass that code using <code>php</code> and save it in mysql.</p>
  
  <p><code>home.ts</code> side code:</p>
  
  <pre><code>this.divCodesub = document.getElementById(this.selectedDivCodesub);
  console.log (this.divCodesub);
  </code></pre>
  
  <p><strong>Data in console.log is:</strong></p>
  
  <pre><code>&lt;div id="0"&gt;&lt;div id="change_color" class="heading-back context_menu"&gt;&lt;div class="row"&gt;&lt;div contenteditable="true" class="col-md-12 heading-sec context_menu"&gt;Hi there, Im &lt;span contenteditable="true" class="head-clr"&gt;STACK&lt;/span&gt;&lt;/div&gt;&lt;div contenteditable="true" class="col-md-12 heading-sec context_menu"&gt;Smart, simple and responsive.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>Now when we try to send using php, it is not saving. While saving, it converts html code into <strong>divCode: [object HTMLDivElement]</strong>, this message is seen in Network.</p>
  
  <p>How can we pass it?</p>
  
  <p><strong>Edit: 1</strong>
  How we are sending the variable to php, see code below -</p>
  
  <p><code>home.ts</code> code:</p>
  
  <p>let params   = </p>
  
  <pre><code>    'divI='+this.list[this.selectedDivCodesub].div_id+'&amp;divCode='+this.divCodesub;
              this._updateSection.callService(api,params).subscribe(data=&gt;{
   ...
  });
  </code></pre>
  
  <p><code>service.ts</code> code:</p>
  
  <pre><code> callService(api,params){
          var headers = new Headers();
          headers.append('Content-Type', 'application/x-www-form-urlencoded');
          return this._http.post(this._url+api,params+"&amp;"+this.randomno,{headers:headers})
                 .map((response:Response) =&gt; response.json());
      }
  </code></pre>