What are you working on today?

Thread Rating: 9 votes, 5.00 average.
(9 votes)
Results 6,201 to 6,205 of 6205

  1. Post
    Bit of experience and you'll filter those answers out easily enough.

  2. Post
    Viilai wrote:
    Bit of experience and you'll filter those answers out easily enough.
    Thanks, thats encourageing.

  3. Post
    Xenolightning wrote:
    Let's call them the SAaS.
    Btw was does that stand for? Squad assualt as service?

  4. Post
    Kid6o6 wrote:
    Thanks, yes the jquery wasn't hard, got that going. Though i'm having some trouble centering teh div... it fades in then flows up to the bottom of the parent... anyway i can figure that out.

    I've also got a php script that looks like it will work but i don't have a host with a domain email so haven't been able to test. The AJAX post method to the php script still hasn't clicked yet. So many tutorials and stack overflow answers are incomplete, assume knowledge or are just wrong....learning this stuff can be infuriating..
    ***You can use your own email address, Sign up to AWS and use Amazon Simple Email Service.

    Instead of <form action="sendmessage.php" method="post">

    You would use this instead

    Html
    <form id="messageform">
    ...
    ...
    ...
    <button onclick="SendMessage()">Send</button>
    </form>

    <div id="successmessage" style="display:none;">
    Success!
    </div>

    Jquery

    Code:
    function SendMessage(){
    $.ajax({
            url: "sendmessage.php",
            method: "POST",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            data: {
                FirstName: $("#first_name").val(),
                EmailAddress: $("#email_address").val(),
                Subject: $("#subject").val(),
                Message: $("#message").val()
            },
            success: function(data) {
            If your php returns true, do something here
            setTimeout(function() { Result() }, 1000);
            },
            error: function() {
            }
        });
    }
    
    function Result() {
            //http://api.jquery.com/hide/
            $( "#messageform" ).hide();
            $( "#successmessage" ).show();
    }
    Then use the following example to send to your email address

    ***http://docs.aws.amazon.com/ses/lates...-smtp-php.html

    I've not used PHP before but that example looks easy enough to modify or integrate into your existing logic.

    You might also need some visual indication that the ajax post is actually doing something so you might want to add a progress spinner or what ever they're called. If you're using some framework like bootstrap or materialize have a look in the documentation if not use the one below.

    https://www.w3schools.com/howto/howto_css_loader.asp

    Code:
    <div class="loader" style="display:none"></div>
    Code:
    $(document).ajaxStart(function () {
        $("#loader").css("display", "block");
    });
    
    $(document).ajaxComplete(function () {
        setTimeout(function () {
            $("#loader").css("display", "none");
    }, 1000);
    });
    Last edited by sic.verse; 24th May 2017 at 5:30 pm.

  5. Post
    Legend, thank you.