Monaca Onsen UI Discord Chat Github Repo

onsen ui wont allow me to make ajax call in child pages but it allows for the ho,e/parent page



  • Thanks alot it works



  • @ricardogaynor No problem and glad you got it working! :thumbsup:



  • so is there anyway around this to use jquery on child pages base on the onsen version like 2.0 betta.



  • @ricardogaynor Of course you can use jQuery. It all depends upon your level of familiarity with that framework. Instead of xhr, jQueries ajax is equivalent. I prefer vanilla JS so that is why I do my demos in it.

    As I stated earlier, every framework is simply an abstraction of vanilla JS, so if you can do it in vanilla, you can surely do it in the framework.



  • thanks i jus do it with jquery ajax and i works thanks. so vanilla js is the foundation of all the frameworks ? and how does vanilla js different from javascript by itself ?
    thanks again your help make me won the national Agri-Tech competition in jamaica using the onsen framwork to build a app with database backend



  • @ricardogaynor Congratulations on the competition - do post your app, we would all love to see your work.

    When we refer to vanilla Javascript, what we mean is just plain old javascript. The original - nothing added. Thus, every javascript framework is built on the default javascript or vanilla javascript.

    I use vanilla in my own code because in my opinion - for most projects that I do unless they are corporate applications - I never use all the features of the framework. The extra load time, processing and memory required to run it, usually doesn’t outweigh the benefits I am getting. So, plain old javascript is easiest and best for what I need.

    Another thing to consider, is that a lot of the apps I do, may not be run on the latest and greatest phones. Additionally, people may not have access to 4G speeds or great wifi, so I like to keep my apps as stripped down as possible so the user is not downloading unnecessary files and such to make it better for the end user. The last thing I will say, is your apps success is always directly tied to how well the users enjoy it. If they cannot use it, then all the wonderful code you created was only for yourself. Always think about your users first.



  • yes i will soon its a praedial larceny app i want the government to buy into so am not sure about posting it. the reason why i chose a framework is that i found good tutorials in using jquery than the old javascript but i will go to code academy to learn it and all of the framework will be a walk over as u stated before



  • @ricardogaynor Interesting application. Agriculture theft is huge area that is very difficult to control. You definitely have tackled a tough area and won! Always do whatever you think is best for you and good luck in your endeavors!



  • Yea thanks so i used php and mysql to run the backend of the app. do you have any suggestion for a faster backend for mobile apps rather than php



  • Well, there are a lot of options to go with and they all have their advantages.

    • Monaca Cloud has remote databases they call collections. You get 3 with the free account and some limitations. You would just use javascript and their API to use it. This is good but does require internet connection for the user.
    • PHP/MySql as you are currently using it is a tried and true method. You use javascript to access it and it works well, but you must also rely on the server speed and internet connection.
    • SQLite is built into HTML5 and Onsen. This is a local database on the device and would be the quickest to run and not require internet on the users device. You could do offline support and when online, sync the local and remote PHP/MySQL databases to keep everything up to date dependent upon your application.

    Ultimately, it all depends on your application, but relying on a network connection will always be the slowest part of your app and it doesn’t matter if you used ColdFusion, PHP, .NET, etc.



  • @munsterlander thank you very helpful so ive started using the ide. am developing an app for a business but i dony=t know how much to charge. how much would you chasrge to develop an app that share pictures, search databases, listen radio, watch videos, send sms and and offer a cms feature for the admin. i want a rough cost. like whats the cost over 1000 to 30000 usd or below that? give me a rough cost please i have to suggest it at a meeting tomorrow



  • @ricardogaynor Wow! Thats a huge app. Are you doing back-end development as well? Are you having to setup the server environment as well? Also, what about support and implementation? Future code upgrades?

    EDIT: Individually, the requested items are pretty simple to implement, but I would assume that somehow it needs to all be integrated. Email me at cfuze@cfuze.com with more details and I will respond with what I think it would cost as I don’t feel the forums are the best place for this.



  • @munsterlander thanks i sent you the mail just a while ago my mail address is ricardogaynorgaynor@gmail.com



  • <script>

    $(document).ready(function(){
    $(’#buttonx’).click(function(){
    navigator.geolocation.getCurrentPosition(function(pos){
    var latitude = pos.coords.latitude;
    var longitude = pos.coords.longitude;
    var longitude1 = longitude;
    var latitude1 = latitude;
    var username = $(’#username’).val();
    var password = $(’#password’).val();
    var reportdetail = $(’#reportdetail’).val();

    // alert(latitude);
    // alert (latitude);
    $.ajax({
    type:‘POST’,
    url:‘http://192.168.1.6/pls/locationpg.php’,
    data:‘latitude=’+latitude+’&clongitude=’+longitude+’&username1=’+username+’&password1=’+password+’&reportdetail1=’+reportdetail,
    success:function(msg){
    if(msg){
    $("#location").html(msg);
    alert(longitude);
    alert(latitude);
    }else{
    $("#location").html(‘Not Available’);
    }
    var username = $(’#username’).val(’’);
    var password = $(’#password’).val(’’);
    var reportdetail = $(’#reportdetail’).val(’’);
    }

    }).error(function(){
        $('#feedback1').text("");
    }).complete(function(){
        $('#feedback2').text("");
    }).success(function(){
        $('#feedback3').text("");
    });
    

    });
    });
    });

    </script>



  • <?php
    $con = new mysqli(“localhost”, “root”, “”, “pls”);
    if ($con){
    echo “connection successful”;
    }else {
    echo “connection isn’t successful”;
    }
    if (isset ($_POST[‘longitude’]) && isset($_POST[‘latitude’])){
    $longitude = filter_input(INPUT_POST, ‘longitude’);
    $latitude = filter_input(INPUT_POST, ‘latitude’);

    $insert = mysqli_query($con, “INSERT INTO geolocation VALUES (’$latitude’, ‘$longitude’, ‘’)”);
    if ($insert){
    echo “data inserted successful”;
    echo $lat.’<br>’.$long;
    }else if (!$insert){
    echo “data wasnt inserted successfully”;
    }
    }
    ?>



  • @ricardogaynor

    You will definitely want to edit your posts so the code shows properly (just select all the code and then click the </> button), but I know what you are wanting to do. Your problem is this:

    $longitude = filter_input(INPUT_POST, ‘longitude’);
    $latitude = filter_input(INPUT_POST, ‘latitude’);
    

    This should be:

    $longitude = filter_input(INPUT_POST, $_POST[‘longitude’]);
    $latitude = filter_input(INPUT_POST, $_POST[‘latitude’]);
    

    EDIT: To also strengthen your PHP, you should be using some other methods. Learn more about that here:

    http://stackoverflow.com/questions/5087403/how-to-properly-filter-input-from-users-in-php

    and

    http://php.net/manual/en/mysqlinfo.api.choosing.php

    I prefer mysqli, but that is just me as PDO has some great features.



  • i am using straight mysqli as you see but why would this geolocation post successfully and inserted into a database abd dont do the same when it is compile, i am wondering if the phonegap webview that wrap our app to make it look native implement a feature to restrict user from doing this am jus suggestion but am gonna try that



  • i’ve always using this method to filter form for alot of apps and websites but when i try use it with feolocation it dont work on the phone



  • Might want to check your cross domain policy as well.



  • yea but cordova dont restrict cross domain because i use it to post data to online serve without modifying the origin permisson access something like that