www.webdeveloper.com
Results 1 to 4 of 4

Thread: Jquery ajax help.

Threaded View

  1. #1
    Join Date
    Jan 2005
    Location
    UK
    Posts
    381

    Jquery ajax help.

    Can anyone please help me get my ajax post working? I cant get detailed error messages, all I know is that ajax php page doesnt return anything.

    Any help very much appreciated:

    Jquery:

    Code:
           $.post("ajax.php?action=add",
    		   	{ start: $.fullCalendar.formatDate(start, "yyyy-MM-dd HH:mm:ss"), end: $.fullCalendar.formatDate(end, "yyyy-MM-dd HH:mm:ss") },
                function(data){
    				 var fancyContent = ('<div class="header">Request sent</div>');
    			    $.fancybox({
                    content: fancyContent
                });
                }
    			, "json");
    Ajax.php

    PHP Code:


    <?php
    $dbhost 
    'xxx';
    $dbuser 'xxx';
    $dbpass 'xxx';
    $conn mysql_connect($dbhost$dbuser$dbpass);
    if(! 
    $conn )
    {
      die(
    'Could not connect: ' mysql_error());
    }


    $action $_GET['action'];
    if(
    $action =='add')
    start = ;start = $.fullCalendar.formatDate(start"YYYY-MM-dd HH:mm:ss");

     
    $sql "INSERT INTO events (". $.fullCalendar.formatDate(start'YYYY-MM-dd HH:mm:ss') .",". $.fullCalendar.formatDate(start'YYYY-MM-dd HH:mm:ss') . ")";


    mysql_select_db('importtest');
    $retval mysql_query$sql$conn );
    if(! 
    $retval )
    {
      die(
    'Could not enter data: ' mysql_error());
    }
    echo 
    "Entered data successfully\n";
    mysql_close($conn);

    }
    ?>
    Last edited by mattastic; 12-11-2012 at 10:43 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles