Its a nice group
What is difference between Oracle and SQL Server
I found the problem. I was missing the dataType option:
$(document).ready(function(){
$("form#submit").submit(function() {
var email = $('#email').attr('value');
$.ajax({
type: "POST",
url: "ajax.php",
data: "email="+ email,
After a little more twiddling ... This works:
$(document).ready(function(){
$("form#submit").submit(function() {
var email = $('#email').attr('value');
$.ajax({
type: "POST",
url: "ajax.php",
data: "email="+ email,
succes
Hi again,
I tried that but got the same results.
if(res.result == '1') {
$('form#submit').hide();
$('div.success').fadeIn('medium');
} else {
$('div.error').show();
}
if(res.result == 1) {
$('form#submit').hide();
$('div.success').fadeIn('medium');
} else {
$('div.error').show();
}
On another thread, someone pointed out to me that json_encode was
supposed to 'know' if the data values were numeric or string and only
quote the latter. That was not my experience, and perhaps not yours,
either. Try '1' as the value you compare to instead of 1.
On Jan 4, 1:05 pm, rob303 wrot
Interestingly, in the Firebug console I'm seeing the correct
responses:
{"result":1}
or
{"result":0}
How can I access these inside my $.ajax() call?
Many thanks again for all the help!
Rob.
On Jan 4, 5:57 pm, rob303 wrote:
> Yes, the missing semicolons are an error in the post. I tried to
Yes, the missing semicolons are an error in the post. I tried to echo
the json_encode() call but I still can't get it to work. If I leave
the email input blank no email is sent. If I enter a string the email
is sent. The 'div.error' is always displayed regardless what's posted.
Here's my full cod
You must 'echo' the JSON output. Also you indicate periods ending
code lines, instead of semicolons but perhaps that's just an error in
your post, not the actual code?
On Jan 4, 10:38 am, rob303 wrote:
> Hi,
>
> Many thanks for the help. I had a go at implementing what you
> suggested but I'm
Hi,
Many thanks for the help. I had a go at implementing what you
suggested but I'm clearly still missing something.
Here is my $.ajax() call:
--
$(document).ready(function(){
$("form#submit").submit(function() {
var email = $('#email').attr('value');
Return a JSON object.
Construct a PHP array such as $json_data = array('result' => 0,
'error' => 'This is an error'). End your PHP script with json_encode
($json_data). Then you can reference del.result and del.error (I'm
referring to your definition of the' success' function from your
sample c
11 matches
Mail list logo