Asp.Net + JQuery - Set CSS in function.Ready
<p>I need to set CSS values in the ready function below.</p>

<pre><code>   $(document).ready(function ()
   {
      $("&lt;div id='" + 1 + "' class='box'&gt;&lt;/div&gt;").css("left", 105).css("top",  54).appendTo("#center").draggable();
      $("&lt;input type='text'&gt;&lt;/input&gt;").appendTo("#" + 1);
    }
</code></pre>

<p>It works fine, then it create a textbox within a draggable div and place them at top:54 and left 105. Now I need to get X,Y from server query, and I've tried this:</p>

<pre><code>    $(document).ready(function ()
    {
        $.ajax({
            type: "POST",
            url: "Default.aspx/Get",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (msg)
            {
                var singleControls = msg.d.split('.');

                $.each(singleControls, function (key, value)
                {
                    var singleParameters = value.split(',');

                    if (singleParameters[0] != "")
                    {
                        var ids = singleParameters[0];
                        var type = singleParameters[1];
                        var cordX = singleParameters[2];
                        var cordY = singleParameters[3];

                        var container = $("#center").position();
                        var x_Coord = cordX - container.left;
                        var y_Coord = cordY - container.top;
                        $("&lt;div id='" + ids + "' class='box'&gt;&lt;/div&gt;").css("left", cordX).css("top", cordY).appendTo("#center").draggable();
                        $("&lt;input type='text'&gt;&lt;/input&gt;").appendTo("#" + ids);
                    }
                });
            }
        });
</code></pre>

<p>Where Get() returns X,Y, with this it creates the div, but it places it at 0,0.
Can someone please explain why this isn't working?</p>

<p>sample: <a href="https://skydrive.live.com/redir.aspx?cid=d7fc3da7fdbc700d&amp;resid=D7FC3DA7FDBC700D!302&amp;parid=D7FC3DA7FDBC700D!301" rel="nofollow">https://skydrive.live.com/redir.aspx?cid=d7fc3da7fdbc700d&amp;resid=D7FC3DA7FDBC700D!302&amp;parid=D7FC3DA7FDBC700D!301</a></p>
