Escaping in eval's argument
<p>I'm using <code>eval</code> to assign dynamic object's properties.</p>

<pre><code>property_name_1 = property1;
property_name_2 = property2;
property_value_1 = 1;
property_value_2 = 2;
var obj = new Object;

eval("obj."+property_name_1+"='"+property_value_1+"'");
eval("obj."+property_name_2+"='"+property_value_2+"'");
</code></pre>

<p>then I'm using this object as post data during ajax request.</p>

<p>Everything is ok, but as well known eval is not safe function and I should escape <code>property_value_1</code>, <code>property_value_2</code>. For example, <code>property_value_2 = "&lt;a href=''&gt;Yahoo!&lt;/a&gt;"</code> will cause error.</p>

<p>What is the best way to do it?</p>

<p>Thank you</p>
