Send data to remote server using jsonp

Saravanan M P

Here is My code: server A

$(function() {

        var diffDomainUrl = 'http://domain_B.com/analtyics/cookie.php?jsoncallback=mycallback';

    $('.idlink').on('click', function() {
        $.ajax({
            url: diffDomainUrl,
            dataType: 'jsonp',
            data: {},
            success: function (data, textStatus) {
                console.log(textStatus);
                console.log(data);
            },
            jsonpCallback: 'mycallback'
        });
    });

});

and server B

<?php
$_GET['jsoncallback'];
if(isset($_GET['jsoncallback']))
{
setcookie("T_LNG",$_GET['jsoncallback'],strtotime('+30 days'));

echo $_COOKIE['T_LNG']."Welcome";
} ?>

in this code i m not getting anything. i don't know whthere its working or not or my method is wrong.

Sridhar R

Your url contain call back already so dont set that in ajax remove and try remove this jsonpCallback: 'mycallback'

Try this

$(function() {

        var diffDomainUrl = 'http://domain_B.com/analtyics/cookie.php?jsoncallback=mycallback';

    $('.idlink').on('click', function() {
        $.ajax({
            url: diffDomainUrl,
            dataType: 'jsonp',
            data: {},
            success: function (data, textStatus) {
                console.log(textStatus);
                console.log(data);
            }

        });
    });

});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Send data using POST to JSONP request

From Dev

ssh or cURL to send data to remote server

From Dev

Using PSFTP to send file to remote server

From Dev

JSONP - Error 403 - Forbidden on Remote Server

From Dev

Send information to remote server

From Dev

Kafka - Unable to send a message to a remote server using Java

From Dev

How send tmux prefixer to remote server using iterm2

From Dev

Send post data to server using Volley android

From Dev

Send Data to Server in Android using JSON

From Dev

How to send data to the server(api) using swift

From Dev

Get a simple JSONP object from a remote server php file using ajax (and jquery) embedded in javascript directly in my wordpress page

From Dev

Get data from third party Node.js server hosted on Vagrant VM using jQuery - JSONP

From Dev

How do I only send response.data to my controllers instead of the entire response when using $http.jsonp?

From Dev

Put Json/Jsonp data to a form using ajax

From Dev

Using JSONP and I have 'ReferenceError: data not defined'

From Dev

Unable to post data using JSONP on Cross Domain

From Dev

How to loop - JSONP / JSON data using R

From Dev

Unable to post data using JSONP on Cross Domain

From Dev

How to read data using JSONP, Ajax and jquery?

From Dev

Angularjs - Displaying data using $http get from remote server

From Dev

Using Http to Fetch Remote Data from a Server in Ionic 2

From Dev

Fetch data from a remote server periodically using curl

From Dev

Expect script: Create method to login to a remote server using ssh and send commands after method has returned

From Dev

Create a text files from the output of find command and send the text file to a remote server using SFTP

From Dev

send multiple data to server

From Dev

Send data to Delphi server

From Dev

How to send a JSON data object to the server using Javascript XMLHttpRequest?

From Dev

How to send data param to server using datatables jquery

From Dev

How to send data in these <div>s to the server using JSON?

Related Related

  1. 1

    Send data using POST to JSONP request

  2. 2

    ssh or cURL to send data to remote server

  3. 3

    Using PSFTP to send file to remote server

  4. 4

    JSONP - Error 403 - Forbidden on Remote Server

  5. 5

    Send information to remote server

  6. 6

    Kafka - Unable to send a message to a remote server using Java

  7. 7

    How send tmux prefixer to remote server using iterm2

  8. 8

    Send post data to server using Volley android

  9. 9

    Send Data to Server in Android using JSON

  10. 10

    How to send data to the server(api) using swift

  11. 11

    Get a simple JSONP object from a remote server php file using ajax (and jquery) embedded in javascript directly in my wordpress page

  12. 12

    Get data from third party Node.js server hosted on Vagrant VM using jQuery - JSONP

  13. 13

    How do I only send response.data to my controllers instead of the entire response when using $http.jsonp?

  14. 14

    Put Json/Jsonp data to a form using ajax

  15. 15

    Using JSONP and I have 'ReferenceError: data not defined'

  16. 16

    Unable to post data using JSONP on Cross Domain

  17. 17

    How to loop - JSONP / JSON data using R

  18. 18

    Unable to post data using JSONP on Cross Domain

  19. 19

    How to read data using JSONP, Ajax and jquery?

  20. 20

    Angularjs - Displaying data using $http get from remote server

  21. 21

    Using Http to Fetch Remote Data from a Server in Ionic 2

  22. 22

    Fetch data from a remote server periodically using curl

  23. 23

    Expect script: Create method to login to a remote server using ssh and send commands after method has returned

  24. 24

    Create a text files from the output of find command and send the text file to a remote server using SFTP

  25. 25

    send multiple data to server

  26. 26

    Send data to Delphi server

  27. 27

    How to send a JSON data object to the server using Javascript XMLHttpRequest?

  28. 28

    How to send data param to server using datatables jquery

  29. 29

    How to send data in these <div>s to the server using JSON?

HotTag

Archive