EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: crosemffet on December 06, 2012, 03:02:36 PM



Title: load form data problema
Post by: crosemffet on December 06, 2012, 03:02:36 PM
my form:
<form id="contactForm">
<input class="easyui-validatebox inputTextBox" style="width:340px" name="uname" />
</form>
if I do: $('#contactForm').form('load',{"uname":"my name"}) works ok.
trying to complete with following code: $('#contactForm').form('load', './myUrl.php?action=getContactByTag&tag=1') doesn't work at all.
json response is:
[{"uname":"my name"}]
what's wrong with my json response?
thanks in advance


Title: Re: load form data problema
Post by: stworthy on December 08, 2012, 05:59:56 PM
The json data returned from your server should be:
{"uname":"my name"}


Title: Re: load form data problema
Post by: crosemffet on December 09, 2012, 05:41:08 AM
ok, but the data return was created by standard php json_encode function:
$items  = array();
while($row = pg_fetch_object($rs)){
  array_push($items, $row);
}
echo json_encode($items);
so json_encode returns [{"uname":"my name"}]
any idea...?