Jump to content

Recommended Posts

PhO6

 

Does the following mean that one of the fields in the POST data is vote and its value id (pmc)? Like, if it were GET instead of post, would it be:

 

ajax.php?vote=pmc

 

action=vote
ajax_module=tracking
dir=1
id=pmc
module_type=public

 

Sorry if I worded this to where it's hard to understand.

Link to comment
https://forums.phpfreaks.com/topic/266749-reading-a-post-request/
Share on other sites

Can you send AJAX requests on other domains? Such as this:

 

<p id="message" style="display:none;"></p>
<input type="submit" id="send" value="Send">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    var alreadyShown = false;
    function send(){
        var send = $.ajax({
            url: 'EXTERNAL URL',
            type: 'POST',
            data: {action : 'vote', ajax_module: 'tracking', dir: 1, id: 'ralfs-survival', module_type: 'public'},
            dataType: 'text'
        });
        
        if(!alreadyShown){
            $('#message').text('Sending...').fadeToggle('slow');
            alreadyShown = true;
        }else{
            $('#message').text('Sending...');
        }

        send.fail(function(response){
            $('#message').text('Failed: '+response);
        });

        send.done(function(response){
            $('#message').text('Sent - Possible response:<br/>' + response);
        });
    }

    $('input[id="send"]').click(function(){
        send();
    });
});
</script>

 

Always returns a failed attempt.

Can you send AJAX requests on other domains? Such as this:

 

Sure you can, how else do you think you can log into sites like google, twitter, facebook, or any other site through single-sign-on services?  You need to know what parameters the receiver expects and what language to communicate to it width.

Actually, what Mahngiel posted is a truth with modifications.

 

There is no native support for cross-domain AJAX requests, due to the same origin policy. Which was implemented to help prevent XSS and similar attacks.

However, there are some libraries and methods out there that can make this possible. One such library is ACD, JSONP is another alternative (supported by jQuery), or you could use CORS which is a new draft from W3C to handle just this kind of scenarios.

PhO6

 

Does the following mean that one of the fields in the POST data is vote and its value id (pmc)? Like, if it were GET instead of post, would it be:

 

ajax.php?vote=pmc

 

action=vote
ajax_module=tracking
dir=1
id=pmc
module_type=public

 

Sorry if I worded this to where it's hard to understand.

No, it shows you exactly what it looks like as "Source". It's not vote=pmc, it's action=vote and id=pmc and a bunch of others.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.