MySQL_Narb Posted August 7, 2012 Share Posted August 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted August 7, 2012 Author Share Posted August 7, 2012 To clarify: The POST request it going from the client to the server. How can I get the name of the POST params being sent? Since sending the data would be via an AJAX request, I should be able to find the params used. Quote Link to comment Share on other sites More sharing options...
requinix Posted August 7, 2012 Share Posted August 7, 2012 ...They're right there: action, ajax_module, dir, id, and module_type. Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted August 7, 2012 Author Share Posted August 7, 2012 That's what I thought, but the script doesn't seem to accept the data (I can tell by looking at another page to see if the data has changed (toggling my vote on a server page)). Quote Link to comment Share on other sites More sharing options...
MySQL_Narb Posted August 7, 2012 Author Share Posted August 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
Mahngiel Posted August 7, 2012 Share Posted August 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted August 7, 2012 Share Posted August 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 7, 2012 Share Posted August 7, 2012 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.