Jump to content

Search the Community

Showing results for tags 'ajax post'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. hi everyone i am still fairly new to AJAX and am not clear how to get values to return from the sucess of my AJAX POST. i have enclosed my function below. it works. however the callback is not returning the values and i am not sure why. i would appriciate any adivice on this. $(".buttona").click(function(e) { e.preventDefault(); // validate and process form // first hide any error messages $('.error').hide(); //get the values from teh field var valid = ''; var required = ' is required.'; var name = $("form input#name_sec").val(); var email = $('form input#email_reg').val(); var cat = $('form #cat option:selected').val(); var location = $('form #country_loc option:selected').val(); var honeypot = $('form input#honeypot').val(); var humancheck = $('form input#humancheck').val(); // perform error checking if (name == '' || name.length <= 1 || name == 'name*' ) { valid = '<p>Your name' + required +'</p>'; } if (!email.match(/^([a-z0-9._-]+@[a-z0-9._-]+\.[a-z]{2,4}$)/i)) { valid += '<p>Your email' + required +'</p>'; } if (cat == '' || cat.length < 1) { valid += '<p>Please tell us whether you are; seeking work or looking for a careworker' + required + '</p>'; } if (location == '' || location.length < 1) { valid += '<p>Please tell us your current location' + required + '</p>'; } if (honeypot != 'http://') { valid += '<p>System error, unable to register you at this moment. </p>'; } if (humancheck != '') { valid += '<p>ystem error, unable to register you at this moment </p>'; } // let the user know if there are erros with the form if (valid != '') { e.preventDefault(); $('form #response').removeClass().addClass('error') .html('<strong>Please correct the errors below.</strong>' +valid).fadeIn('fast') } else {//start else cluase for where the form validates $('.homepage_reg_form').removeClass().addClass('processing').html('Processing...').fadeIn('fast'); // alert(name); alert(email); alert(cat); alert(location); alert(honeypot); alert(humancheck); var dataStrings = 'name=' + name + '&email=' + email + '&cat=' + cat + '&country_loc=' + location + '&honeypot=' + honeypot + '&humancheck=' + humancheck ; // alert(dataString) $.ajax({ type: "POST", url: "cms/views/jobs/joint_reg_ajaxversion.php", data: dataStrings, success: function(data) { $('.processing').removeClass().html("<div id='message'></div>").fadeIn('slow'); $('#message').html("<h2>The Registration Form Has Been Submitted!</h2>") .append("<p>An email has been sent to you. To activate your membership, kindly click the link in the email.</p>") .append("<img id='checkmark' src='images/check.png' />") .fadeIn(1500, function() { $('#message').html(data.msg); }); // .append("<img id='checkmark' src='images/check.png' />") } }); }//end "else clause" for where the form validates and is sent to database //the return false below prevents the browser from sending the form via normal methods return false; }); //END THE FUNCTION FOR THE SUBMISSION OF "QUICK REGISTRATION" VIA AJAX Below is the code for the receiviing page. if (!empty($error_message)) { $return['error'] = true; $return['msg'] = "<h3>Oops! The form was not not filled out correctly.</h3>".$error_message; echo json_encode($return); } else { $return['error'] = false; $return['msg'] = "<p>Thanks for registering " .$name .".</p>"; $form_completedcorrectly ='its correct'; echo json_encode($return); }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.