SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist runeveryday's Avatar
    Join Date
    Jul 2009
    Posts
    436
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    why this way is wrong ?(jquery)

    Code:
    $.get('myhtmlpage.html', myCallBack(param1, param2));
    this is from the jquery's document,from it's explaination,it says that myCallBack(param1, param2) is evaluated before being passed as a function.i feel this is right,because myCallBack(param1, param2) is the second parameter of $.get(). if this is right,passing myCallBack() return's value to it is ok. any tips would be appreciated
    Outdoor tools online store and wargame tools shop
    with best quality and service.
    comp molle tactical vest tactical clothing etc sell

  2. #2
    SitePoint Zealot
    Join Date
    Apr 2010
    Posts
    154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your call back function will execute after the data has loaded from the html page.

    Try this:

    Code:
    $.get('myhtmlpage.html',function() {
                            alert('HTML Loaded. Callback function!'); 
                            });

  3. #3
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As this documentation said you about that. Since it is clearly said here
    http://docs.jquery.com/Ajax/jQuery.g...tacallbacktype

    That the $.get() has 4 parameters and three of them are optional and second is the data to be passed to the file/url and third is the callback function which is called after successfully loaded the file and the functions will have one parameter which will hold the returned data in a certain format (xml, json, text, etc) depending upon the last parameter. So try dig into that documentation and see how it is used.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •