Issue with Ajax call in a Model

4 posts, 0 answers
  1. XiMnet Malaysia
    XiMnet Malaysia avatar
    46 posts
    Member since:
    Jan 2006

    Posted 01 Dec 2014 Link to this post

    Hi,

    Refering to http://telerik.ximnet.com.my/kendo_test/, the page will call the the function fn_mobileMS_update in model mobileMS.js (http://telerik.ximnet.com.my/kendo_test/js/mobileMS.js)

    In the function fn_mobileMS_update, it will call XiMnet_JS_Tool.fn_XiMnet_ajax_JSONP which is an AJAX call.

    However, I noticed via the console, the success event of the Ajax call is fired after the code in mobileMS.js -> console.log("mobileMS").
    How do I make sure the code will fire only after the Ajax call is completed so that I can get the data? I already set it as async: false,

    Console:
    XiMnet_JS_Tool.js:58 beforeSend - fn_XiMnet_ajax_JSONP
    mobileMS.js:30 mobileMS
    XiMnet_JS_Tool.js:72 success - fn_XiMnet_ajax_JSONP

    Thanks.
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 02 Dec 2014 Link to this post

    Hello,

    I am not sure how the problem you are facing is related to or affected by Kendo UI. Does the code in question work outside of the model context?

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. XiMnet Malaysia
    XiMnet Malaysia avatar
    46 posts
    Member since:
    Jan 2006

    Posted 02 Dec 2014 in reply to Petyo Link to this post

    Hi  Petyo,

    It works in our local development server.
    However, when we upload to a staging server, it has this error.

    In the staging server, the sub-domain is different:
    http://telerik.ximnet.com.my/kendo_test/ calls http://xtopia_platform_d02.ximnet.com.my/api

    Could this be the cause?

  5. XiMnet Malaysia
    XiMnet Malaysia avatar
    46 posts
    Member since:
    Jan 2006

    Posted 03 Dec 2014 in reply to XiMnet Malaysia Link to this post

    I think it is because AJAX with JSONP type cannot be synchronous when cross-domain.
    I will try to find other solution,

    Thanks.
Back to Top
Kendo UI is VS 2017 Ready