Hey.

Hi All. I need help with multiple return variables in an ajax method.
I can't seem to return the variables from my method. But, oddly,
the same method does return the server's data to the appropriate
elements on my page.

THE AJAX CALLBACK METHOD:


 function getData_callback(res) { //0

        try { // 1

            var ds = res.value;
            var min = '9:00am';
            var max = '5:00pm';

            if(ds==null){alert("dataset is empty");}
            if(typeof(ds)!="object"){alert("dataset is not an
object");}
            if(ds.Tables==null){alert("tables are empty");}

            if(ds!=null && typeof(ds) == "object" && ds.Tables!=null) {
// 2

              for(var r=0; r<=ds.Tables[0].Rows.length-1; r++) { // 3

              [snip getting data from the database (and assign data
              to elements on page) ...]

              if (Comparable(Retrieved DB Time) < Comparable(min)) {
                    min = Retrieved DB Time;}
               if (Comparable(Retrieved DB Time) > Comparable(max)) {
                    max = Retrieved DB Time;}

              } //3 end r loop
             } // 2 end if statement

            } // 1 end try statement
          catch(e){alert("getData_callback error: " + e.description);}
// end catch

          return [min, max];

         } // 0 end getData_callback function




THE METHOD USED TO CALL THE SERVER CODE:

Code:

 function getData() {

        try {
            var response =
user_home.user_calendar.getData(getData_callback);
        } // end try

        catch(e){alert("getData() error: " + e.description);} // end
catch

        return response;

    }



THE ABOVE METHOD CALLED INSIDE THE ASP.NET CODE THAT FIRES THE AJAX
CODE:

Code:

function FetchCalendar()
                                            {

                                                try {


                                        getData();

                                        }catch(e){alert("Fetch Calendar
function error: " + e.description);}

                                    }



when i assign getData() to a variable, say 'x', and alert it i get
"true" which means that the callback worked. when i try x[0] or x[1] i
get 'undefined'. so, i am doing something wrong when trying to return
variables min and max (return [min,max]).

any thoughts on why i can successfully get my getData_callback method
to assign the returned dataset to asp.net elements on the page but cant
return the variables min and max?

thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at 
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---

Reply via email to