I need to send an AJAX request to, for example, port 8080 where a daemon is running there.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You cannot
POSTinformation cross domain, subdomain, or port number. You can however use JSONP if you have access to both the daemon and the requesting site. If data needs to be returned, then thedaemonneeds to support acallbackquery parameter and return it properly formatted.Pass the information to the daemon:
Now just make sure your daemon handles the
callbackparameter. For instance, ifcallback=mycallbackthe return from the daemon (the only thing written to the page) should look like this:For an key/value pairs:
For an array:
If you do not have a JSONP or similar mechanism in place, you cannot communicate cross domain using jQuery.