Results 1 to 2 of 2

Thread: Problem "Cannot modify header information" Ajax pluggable.php

  1. #1
    Thread Starter
    libertalia's Avatar
    Join Date
    Jan 2013
    Location
    France
    Posts
    22
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Problem "Cannot modify header information" Ajax pluggable.php

    Hi All

    During registration of the user, I want to save its coordinates (latitude and longitude) in the database via the address entered. To do this, I use the Google Map API and AJAX for the record in the database.
    The record in the database is done correctly.
    Normally, after registration, the user should be redirected to the home page and be connected.
    But I have these error messages :
    Warning: Cannot modify header information - headers already sent by (output started at /home/horseevo/public_html/wp-content/themes/classipress-labzip/functions.php:820) in /home/horseevo/public_html/wp-includes/pluggable.php on line 584

    Warning: Cannot modify header information - headers already sent by (output started at /home/horseevo/public_html/wp-content/themes/classipress-labzip/functions.php:820) in /home/horseevo/public_html/wp-includes/pluggable.php on line 585

    Warning: Cannot modify header information - headers already sent by (output started at /home/horseevo/public_html/wp-content/themes/classipress-labzip/functions.php:820) in /home/horseevo/public_html/wp-includes/pluggable.php on line 586

    Warning: Cannot modify header information - headers already sent by (output started at /home/horseevo/public_html/wp-content/themes/classipress-labzip/functions.php:820) in /home/horseevo/public_html/wp-includes/pluggable.php on line 748

    Here is my code :


    In the function.php in the child theme lapzip :

    Code:
    <script type='text/javascript'>
            var address = '$adresse';
            geocoder = new google.maps.Geocoder();
            geocoder.geocode({ 'address': address}, function(results, status) {
                if (status == google.maps.GeocoderStatus.OK) {
                    var latitude_adresse = results[0].geometry.location.lat();
                    var longitude_adresse = results[0].geometry.location.lng();
                    $(document).ready(function() {
                        $(function(){
                            $.ajax({
                                type: 'POST',
                                data: {'user_id':$user_id,'user_lat':latitude_adresse,'user_lng':longitude_adresse},
                                url: 'http://horse-evolu.com/wp-content/themes/classipress-labzip/update_profile_latlng.php'
                            });
                        });
                    });
                }    
            });
            </script>
    update_profile_latlng.php :

    Code:
    <?php
    $path = $_SERVER['DOCUMENT_ROOT'];
    include_once $path . '/wp-config.php';
    include_once $path . '/wp-load.php';
    include_once $path . '/wp-includes/wp-db.php';
    include_once $path . '/wp-includes/pluggable.php';
    global $wpdb;
    global $current_user;
    $user_id = $_POST['user_id'] ;
    $wpdb->update('wp_users', array("user_lat" => $_POST['user_lat']),array('ID' => $_POST['user_id']));
    $wpdb->update('wp_users', array("user_lng" => $_POST['user_lng']),array('ID' => $_POST['user_id']));
    ?>
    I tried several solutions found on the net (on pluggable.php)
    - Addition of "?>" At the end of the file.
    - Remove empty lines at the beginning and end of file.
    - Remove empty lines in all the file.

    I'm getting out of ideas

    Thank you for your help

  2. #2
    Thread Starter
    libertalia's Avatar
    Join Date
    Jan 2013
    Location
    France
    Posts
    22
    Thanks
    2
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need Help "Warning: Cannot modify header information - headers already sent by.
    By jacqueline in forum Help Using JobRoller
    Replies: 5
    Last Post: March 25th, 2013, 08:05 AM
  2. Replies: 3
    Last Post: January 4th, 2012, 06:32 AM
  3. Warning: Cannot modify header information problem
    By wikimarine in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: June 6th, 2011, 04:23 PM
  4. Post ads (need help with modify header information)
    By Skelbimai in forum ClassiPress General Discussion
    Replies: 1
    Last Post: September 18th, 2009, 04:28 AM