Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8629857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:54:55+00:00 2026-06-12T08:54:55+00:00

What the heck is up with this code? $(.submit).click(function(){ alert(clicked); var name = $(.name).val();

  • 0

What the heck is up with this code?

    $(".submit").click(function(){
    alert("clicked");
    var name = $(".name").val();
    var email = $(".email").val();
    var comment = $(".comment").val();
    var articleId = $(".articleId").val(); 
    var dataString = 'name='+ name + '&email=' + email + '&comment=' + comment+ '&articleId=' + articleId;
    if(name=='' || comment==''){
        alert('Please Give Valid Details');
    }
    else{
        alert('so far so good');
        $.ajax({
            type: "POST",
            url: "../_includes/process.php",
            data: dataString,
            cache: false,
            success: function(){
                alert("succes");
                $(".updating").fadeIn(400);
            }
        });
    }
});

Everything works until $.ajax finds process.php and instead of reading and executing the code it actually goes to that page in the browser. I tried using return false after the ajax call but then the code in process.php never happens.

here is process.php

    <?php 
    // code to establish connection first

    if($_POST){
    $name=$_POST['name'];
    $name=mysql_real_escape_string($name);

    $email=$_POST['email'];
    $email=mysql_real_escape_string($email);

    $comment=$_POST['comment'];
    $comment=mysql_real_escape_string($comment);

    $articleId=$_POST['articleId']; 
    $articleId=mysql_real_escape_string($articleId);

    if(!empty($email)){
            $lowercase = strtolower($email);
    }

    $result = mysql_query("INSERT INTO comments(name,email,comment,articleId) VALUES ('$name','$email','$comment','$articleId')");

    if($result){
            echo "success";
    } else {
            echo "there were erros" . mysql_error();
    }
    exit;

    ?>

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:54:57+00:00Added an answer on June 12, 2026 at 8:54 am

    You have to prevent the default action of your submit button:

    $(".submit").click(function(e) {
        e.preventDefault();
        alert("clicked");
        ...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey SO Guru's im having one heck of a job with this code public
For instance, take this piece of code: var person = new Person(); or for
I am having one heck of a hard time trying to figure this out.
I saw this in some C code: Wininfo W = { sizeof(Wininfo) }; What
Consider this code: magic :: String -> Q Exp magic s = [e| putStrLn
This line of code is what I have in a Sencha TOuch 1.1 app:
I'm having a heck of a time getting this to work - all the
I'm not sure how this is done. I could hard code the route I'm
I'm trying to 'require' some code for the loader, but my current onready function
This should be pretty easy but I'm having a heck of a time doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.