Click here to Skip to main content
15,887,746 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionCode I don't understand. Pin
ChicagoBobT28-Aug-14 7:54
ChicagoBobT28-Aug-14 7:54 
AnswerRe: Code I don't understand. Pin
Graham Breach28-Aug-14 8:58
Graham Breach28-Aug-14 8:58 
GeneralRe: Code I don't understand. Pin
ChicagoBobT28-Aug-14 11:08
ChicagoBobT28-Aug-14 11:08 
GeneralRe: Code I don't understand. Pin
Sunasara Imdadhusen3-Sep-14 21:08
professionalSunasara Imdadhusen3-Sep-14 21:08 
GeneralRe: Code I don't understand. Pin
Sibeesh KV23-Sep-14 19:17
professionalSibeesh KV23-Sep-14 19:17 
AnswerRe: Code I don't understand. Pin
Anlige2-Sep-14 21:01
Anlige2-Sep-14 21:01 
AnswerRe: Code I don't understand. Pin
Suresh Amudalapalli12-Sep-14 7:49
professionalSuresh Amudalapalli12-Sep-14 7:49 
Questionajax/php issue Pin
RalfPeter28-Aug-14 6:38
RalfPeter28-Aug-14 6:38 
ASM
Can someone please help me with this code by looking over it for something obvious? The problem seems to be that the embedded JavaScript code is not being executed and, therefore, the PHP code is also skipped. Both, the HTML and the PHP files are in the root directory.

html/js:


XML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery AJAX test form</title>
<script src="js/jquery.min.js"></script>
<link href="css/bootstrap.min.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
  <!-- Contacts -->
  <div id="contacts">
    <div class="row">
      <!-- Alignment -->
      <div class="col-sm-offset-3 col-sm-6">
        <p>&nbsp;</p>
        <p>Some header message here</p>
        <p>&nbsp;</p>
        <form name="contact" class="well" id="contact">
          <legend>Contact Form</legend>
          <div class="control-group">
            <div class="controls">
              <input type="text" class="form-control" placeholder="Name" id="name" />
              <p class="help-block"></p>
            </div>
          </div>
          <div class="control-group">
            <div class="controls">
              <input type="email" class="form-control" placeholder="Email" id="email" required/>
            </div>
          </div>
          <div class="control-group">
            <div class="controls">
              <textarea rows="10" cols="100" class="form-control" placeholder="Message" id="message" style="resize:none"></textarea>
            </div>
          </div>
          <div id="success"> </div>
          <button type="submit" class="btn btn-primary pull-right" id="submit">Send</button>
          <button type="reset" class="btn btn-default pull-right" id="res">Reset</button>
          <br />
        </form>
      </div>
    </div>
  </div>
</div>
<script>
 $(function() {
    $("button#submit").click(function(event){
        event.preventDefault();
        $.ajax({
            type: "POST",
            url: "process.php",
            data: $('form.contact').serialize(),
            success: function(){
                    alert("success");
            },
            error: function(){
                alert("failure");
            }
        });
    });
});
</script>
</body>
</html>



php:

<?php
if (isset($_POST['name'])) {
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['Email']);
$message= strip_tags($_POST['message']);
echo "Name =".$name."</br>";
echo "Email =".$email."</br>";
echo "Message =".$message."</br>";
echo "<span class=\"label label-info\" >your message has been submitted .. Thank you</span>";
}
?>
ralf.riedel@usm.edu

AnswerRe: ajax/php issue Pin
Dennis E White28-Aug-14 8:45
professionalDennis E White28-Aug-14 8:45 
GeneralRe: ajax/php issue Pin
RalfPeter28-Aug-14 8:58
RalfPeter28-Aug-14 8:58 
SuggestionRe: ajax/php issue Pin
Dennis E White28-Aug-14 10:10
professionalDennis E White28-Aug-14 10:10 
Questionweb-based 3D mapping system using nVidia 3D vision Pin
Member 1101681125-Aug-14 6:33
Member 1101681125-Aug-14 6:33 
Questionmodifying Google Search to make results intentionally inaccurate Pin
Member 1103422325-Aug-14 2:11
Member 1103422325-Aug-14 2:11 
AnswerRe: modifying Google Search to make results intentionally inaccurate Pin
Anurag Gandhi25-Aug-14 23:02
professionalAnurag Gandhi25-Aug-14 23:02 
GeneralRe: modifying Google Search to make results intentionally inaccurate Pin
Member 1103422326-Aug-14 0:14
Member 1103422326-Aug-14 0:14 
GeneralRe: modifying Google Search to make results intentionally inaccurate Pin
Anurag.ag31-Aug-14 11:51
Anurag.ag31-Aug-14 11:51 
QuestionInsert Image in to MySql database Pin
Member 1045703324-Aug-14 23:06
professionalMember 1045703324-Aug-14 23:06 
SuggestionRe: Insert Image in to MySql database Pin
ZurdoDev25-Aug-14 3:18
professionalZurdoDev25-Aug-14 3:18 
AnswerRe: Insert Image in to MySql database Pin
Dennis E White25-Aug-14 4:05
professionalDennis E White25-Aug-14 4:05 
SuggestionRe: Insert Image in to MySql database Pin
Siben Nayak29-Aug-14 5:49
professionalSiben Nayak29-Aug-14 5:49 
GeneralRe: Insert Image in to MySql database Pin
Sunasara Imdadhusen3-Sep-14 21:10
professionalSunasara Imdadhusen3-Sep-14 21:10 
QuestioncreateElement, custom style, turn off webkit Appearance Pin
jkirkerx24-Aug-14 10:13
professionaljkirkerx24-Aug-14 10:13 
GeneralRe: createElement, custom style, turn off webkit Appearance Pin
Sunasara Imdadhusen3-Sep-14 21:11
professionalSunasara Imdadhusen3-Sep-14 21:11 
GeneralRe: createElement, custom style, turn off webkit Appearance Pin
jkirkerx4-Sep-14 6:13
professionaljkirkerx4-Sep-14 6:13 
AnswerRe: createElement, custom style, turn off webkit Appearance Pin
Sunasara Imdadhusen3-Sep-14 21:13
professionalSunasara Imdadhusen3-Sep-14 21:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.