title: How to pass JSON data as parameters in JavaScript function while data appending to the div?
body: <p>jQuery + JavaScript + Rails 4</p>
  
  <pre><code>prefix = "onward_"
  
  json_data = {"367278": 
                 {"bus_schedules": 
                    { "id": 367278,
                      "origin_id": 134,
                      "destination_id": 506
                    },
                  "drop_points": null,
                  "board_points": null,
                  "operator_name": "ABC"
                  }
               }
  
  json_data1 = JSON.stringify(json_data);
  
  html = '&lt;a href="#" id="'+prefix+'active_travel_filter_'+
         operator_ids[i]
         +'"onclick="removeTravelFilter('
         +'\''+prefix+'\''+',\'travels\''+',\''
         +json_data1+'\',\''+json_data1+'\')" 
  
     value="'+operator_ids[i]+'"&gt;'
             +getOperatorName[operator_ids[i]]+'&lt;/a&gt;'
  
  console.log(html);
  
  $("#active_fiters_blk").append(html);
  </code></pre>
  
  <p>//console.log output</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a href="#" id="onward_active_travel_filter_90" onclick="removeTravelFilter('onward_','travels','{"367278":{"bus_schedules":{"id":367278,"origin_id":134,"destination_id":506},"drop_points":null,"board_points":null,"operator_name":"ABC"}}','{"367278":{"bus_schedules":{"id":367278,"origin_id":134,"destination_id":506},"drop_points":null,"board_points":null,"operator_name":"ABC"}}')" value="90"&gt;ABC&lt;/a&gt;
  </code></pre>
  
  <p>But while append to the <code>div</code> I am getting this format, but it should be above format.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;a value="33" group)"}}')"="" group)"}}','{"367278":{"bus_schedules":{"id":367278,"origin_id":134,"destination_id":506},"drop_points":null,"board_points":null,"operator_name":"sre="" booking(ananth="" 367278":{"bus_schedules":{"id":367278,"origin_id":134,"destination_id":506},"drop_points":null,"board_points":null,"operator_name":"sre="" onclick="removeTravelFilter('onward_','travels','{" id="onward_active_travel_filter_33" href="#"&gt;ABC&lt;/a&gt;
  </code></pre>
  
  <p>It should be an inline script only because I want each individual <code>onclick</code> event.</p>