Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8919757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:06:19+00:00 2026-06-15T06:06:19+00:00

This Python code works fine print ‘foo’ params = {‘memberId’: ‘1’} data = urllib.urlencode(params)

  • 0

This Python code works fine

print 'foo'
params = {'memberId': '1'}
data = urllib.urlencode(params)
url = 'http://aaa.bbb.com/ccc/'
req = urllib2.Request(url, data, {'Content-Type': 'application/json'})
f = urllib2.urlopen(req)
response = f.read()

print '===>', response

response = eval(response.decode('unicode-escape'))   
f.close()

I am wondering what’s the corresponding javascript code for this? I tried this, alerted “error”. Currently I am on ddd.bbb.com. The web service is on aaa.bbb.com. I cannot set relative path for this.

Please advise on how to configure cross-domain. Thanks.

jQuery.ajax({
                        url: 'http://aaa.bbb.com/ccc',
                        type: 'GET',
                        contentType: "application/json",
                        dataType: "json",
                        data: {'memberId':'1'},
                        success: function (data) {
                            alert("ok");
                        },
                        error: function () {
                            alert("error");
                        }
                    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:06:21+00:00Added an answer on June 15, 2026 at 6:06 am

    There are approximately one gajillion (that’s my technical estimate 😉 ) other Stack Overflow questions about Javascript’s “same origin policy”, and how you can work around it. I strongly recommend checking them out.

    As a quick summary, your basic options are:

    1. use JSONP (this only works if aaa.bbb.com supports JSONP)
    2. get aaa.bbb.com to add ddd.bbb.com to it’s “safe list” (there’s a better term for it, but I forget it); if you control aaa.bbb.com this is probably your best bet
    3. if you can’t do either of the above, setup a proxy service (Apache alone can handle this) to forward ddd.bbb.com/someUrl to aaa.bbb.com, so that the browser thinks you’re hitting your own domain, but really the content comes from elsewhere.

    And just so you understand the core problem, the gist of it is that browsers don’t let code from evildomain.com access yourbank.com, as a security precaution. However, browsers will let you retrieve scripts from yourbank.com, no matter what your origin is, so you can exploit that using something called JSONP … but for JSONP to work, the owner of yourbank.com has to support it (they have to tailor their scripts for you).

    Browsers will also let you access yourbank.com if yourbank.com explicitly says “it’s cool if evildomain.com messes with us”. They do that by putting a special file in a special place on their site (I forget the details, but they’re easy to look up).

    If you can’t do either of those, you can just get your evildomain.com server to go to yourbank.com for you. Servers aren’t bound by the same restrictions as browsers, so they can visit any site they want. When it does, it can send you back the content it finds there, and this is known as a “proxy” (to yourbank.com through evildomain.com, which is the end doing the proxying).

    Hopefully that clarifies matters a bit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in Python inputted = input(Enter in something: ) print(Input is
Somehow, this works fine in the Maya/Python script editor, but fails when it's inside
I downloaded a webpage in my python script. In most cases, this works fine.
I'm newbie in Python. I can't understand why this code does not work: reOptions
Consider this Python code for printing a list of comma separated values for element
I was given this Python code that would calculate an MD5 value for any
/Users/smcho/Desktop/bracket/[10,20] directory has abc.txt, but when I run this Python code import glob import
This is my Python code - cursor.execute(UPDATE tasks SET task_owner=%s,task_remaining_hours=%s, task_impediments=%s,task_notes=%s WHERE task_id=%s, (new_task_owner,new_task_remaining_hours,new_task_impediments,
I perform this kind of query in my Python code to conn = rdbms.connect(instance=_INSTANCE_NAME,
I've inherited some python code that contains a rather cryptic decorator. This decorator sets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.