Monaca Onsen UI Discord Chat Github Repo

Calling web service(asmx) using Ajax call and return it in Json format



  • Hello, I am building an app using Monaca Cloud and I want to call my web service in http using ajax call but it did not work, anyone who can help me? I have no error upon checking my monaca debugger but data from the web service did not display. Here’s my ajax call

    const login = async () => {

    const data = { 
        user_id: $('#user_id').val(),
        password: $('#password').val() 
     };
     console.log(data);
    
    $.ajax({
        type: "GET",
        contentType: "application/json; charset=utf-8",
        url: 'http://localhost:16642/WebService.asmx/Users',
        data: JSON.stringify(data),
        // capital JSON is the proper way not Json
        crossDomain: true,
        dataType: "json",
        success:function(msg){
            ons.notification.alert(msg);
    
        }
    });
    

    }


  • administrators

    Can you try running your app in the Preview window in Monaca Cloud IDE and then checking the network tab of your browser’s debug tools? There you should be able to see the request and response in full.

    Also, this might be relevant if you’re using Android:
    https://en.docs.monaca.io/reference/power_plugins/in-app_updater#notes-on-android-9+



  • Hello Admin @emccorson , upon checking the network when running the status and type they are both pending. I am only using a trial account for creating mobile application and hoping to work both android and IOS. Btw, thank you for the link I will make sure to read it, but still hoping you can guide me here because I really want to learn. Thank you so much. May I ask what to do next?