Xinhao, The only way to return data from server to client (PHP -> jQuery in this case) is by 'displaying' it in PHP - in other words using echo, print or something similar.
This does mean that anyone could look at what your javascript is doing and do the same, unfortunately there's not much you can do about this. If you're worried about confidentiality then using a login system along with the request should mean that someone can only retrieve the data they are entitled to view. --rob On 7/11/07, Xinhao Zheng <[EMAIL PROTECTED]> wrote:
hi Benjamin, It's very nice for your reply.Thanks a lot!Your advice does help me,but i have another problem. If i don't like the php file to display the data.Because if someone who view the js source will see the url and can request the url in the navigator and get the data.Can i just return json but not display it. Thanks On 7月11日, 上午10时46分, "Benjamin Sterling" <[EMAIL PROTECTED]> wrote: > Xinhao, > Welcome to the list; > > The way I usually do it is something like this: > > php (returns json): > echo '{id:1,fname:"Benjamin",lname:"Sterling"}'; > > javascript: > > $.ajax({ > dataType:'json', > url:'mypage.php', > success : function(info){ > // do something with with "info" > // call return by doing something like > // info.id / info.fname / info.lname > > } > }); > > This should point you in the right direction. > > On 7/10/07, Xinhao Zheng <[EMAIL PROTECTED]> wrote: > > > > > hello everyone, > > I am just a fresher to jQuery.I like it very much.I need some help. > > > Is there any way to request a php file to fetch data from db in jQuery > > then operate on it use js?Ajax can do it? > > > which format would be the best way to return the data,json or xml?how to > > deal with that in js? > > > I just want to implement a calendar and display data from db. > > > Thanks > > -- > Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com
-- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.