I am struggling with a 500 internal server error. I have made just a basic script to test, but its just getting 500 anyways. Do you see a typo or logic errors? I am to blind right now to see an error.
AJAX
$("#select_kjede").change(function(){
var kjede = $("#select_kjede option:selected").val();
$.ajax({
type: "POST",
url: "bestilling/controller.php",
data: {
kjede: kjede
}
})
.done(function( msg ) {
alert(msg);
});
});
PHP
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$message = $_POST["kjede"];
echo "<script type='text/javascript'>console.log("."OLOL ".$message."</script>";
}
In the PHP-script i have tried a numerous methods, included if(isset($_POST['kjede'])
EDIT: In Chrome console under the error -
send
b.extend.ajax
(anonymous function)
b.event.dispatch
v.handle
How can i console out the server errors?
I wanted to ask what your form looks like. But I could not comment. Your code works fine with the following form.
<form id="select_kjede">
<select>
<option>option_one</option>
<option>option_two</option>
<option>option_three</option>
</select>
<input type="submit" value="save"/>
</form>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.