[eluser]Unknown[/eluser]
Quite new to codeigniter and already a strange problem.
I have a simple jquery ajax call which works fine inFF, chrome and even IE6, but returns error in Safari (v4.05 on Mac at least)????
I have broken down the code to almost nothing to try to find the anvwer, but no clue.
You can try it on :
http://www.moonwork.se/trickbaze , just clik the submit button to trigger ajax. I get 2 error messages from the script: 'error0', and just 'error'.
Anybody know what's wrong, specifically for Safari?
Code:
The controller
Code:
<?php
class Ajax_test extends Controller{
function _construct()
{
parent::Controller();
}
function form()
{
echo "Ajax ok!";
}
}
?>
The view
Code:
<?php
?>
<html lang="en">
<head>
<style type="text/css"><!--
@import "<?php echo base_url(); ?>css/original.css";
--></style>
[removed][removed]
[removed]
$('document').ready(function() {
$("form").submit(function(e) {
alert("Klick!");
e.preventDefault();
var stuff = $.ajax(
{
url: "<?php echo base_url(); ?>index.php/ajax_test/form",
type: "GET", data:"amount=" + "1" ,
success: function(data)
{
alert(data)
},
error: function (XMLHttpRequest, textStatus, errorThrown)
{
alert("error" + XMLHttpRequest.status);
alert("error" + XMLHttpRequest.responseText);
}
}
)
});
});
[removed]
<title>Test!!!!!!</title>
</head>
<body>
<div id="searchdiv">
<form name="ajaxtestform" id="ajaxtestform" action="" method="POST" enctype="application/x-www-form-urlencoded">
<input type="text" name="message" value="" size="40" maxlength="40" min="" max="" accept=""/>
<input type="submit"/>
</form>
</div>
</body>
</html>