OK done... I tested it on Firefox, IE, Opera and Safari... and all worked great
it was a bug in my code...
many thanks to dmitrig01 from #drupal... he was a big help yesterday.
Ahmad Al-Obaidy <ahmad@hitech-iraq.com> wrote:
Hello Amr,
Thank you man,
I got it work with with with node service... its more than enough for me!
everything works ok on Firefox... but with IE ... it just not working
my script look like this:
function avl_get_location() {
Drupal.service('node.load',
{nid: avl_nid, fields: ["nid", "title"]},
function(status, data) {
alert(data.title);
}
);
}
** status is always false!
I dont know if it is some bug...
but I will make some checks ... and I will report it here
Amr Mostafa <amr.mostafa@gmail.com> wrote:Hello Ahmed,
In Drupal5 I do this by creating a menu item of the type
MENU_CALLBACK, with a callback e.g. mymodule_get_rank_json() which
goes like:
function mymodule_get_rank_json() {
// ...
// The code to determine rank and put it in $rank.
// ...
// This is how to JSON-ify the returned value
header('Content-type: text/javascript');
print drupal_to_js($rank);
}
drupal_to_js() converts the given parameter to JSON and then you print
that back to the browser. To capture the returned information using
javascript and do something useful with it, check Ajax documentation
in jQuery library (the library that is included and used by default
within Drupal) http://docs.jquery.com/Ajax
Cheers,
- Amr
On 7/15/07, Ahmad Al-Obaidywrote:
> Hi,
>
> I need to display a value given in the database.... the value is modified
> regularly by other programs....
>
> the value should be refreshed regularly .... but not the entire page...
>
> I tried JSON ... but didnt find a useful docs..
> from where should i start?
>