0

I want the content of my load() function to be stored into a variable so to pass it into another function. The project is to pass it as a sting to a function that creates a toast message in a webview for android phones! My code is :

$( '#lightson' ).click( function () {
            $.get( 'http://<?php echo $_SESSION['ip']?>/?2', {}, callbacka() );
            function callbacka() {

                var ua = navigator.userAgent.toLowerCase();
                var isAndroid = ua.indexOf("android") > -1;

                if(isAndroid) {

                Android.showToast("**Here I want to put my content**");

                }
                    else {

                        $('.status2').load('status2.php').delay(3000).queue(function() {
                        $('.status2').empty().dequeue();
                        });

                    }
            }
    } ); 

Can anyone help?

alexgeorg86
  • 145
  • 1
  • 1
  • 8

1 Answers1

1

AHHHH!

You are running your callback immediately! Remove the ():

$.get( 'http://<?php echo $_SESSION['ip']?>/?2', {}, callbacka );
Community
  • 1
  • 1
Naftali
  • 144,921
  • 39
  • 244
  • 303
  • OK for that, but what about my question? I want where the **Here I want to put my content** is to dynamicly put my `load()` content – alexgeorg86 Jan 03 '12 at 16:42
  • also for the `()` I have a problem that I describe here:[link](http://stackoverflow.com/questions/8627985/my-jquery-queued-functions-fail-to-run-after-the-first-time) – alexgeorg86 Jan 03 '12 at 16:49
  • No one can help me with this problem? I want to store the result of load() into a variable... – alexgeorg86 Jan 12 '12 at 00:43