Click here to Skip to main content
13,056,229 members (72,901 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hello guys ,
Stuck at a problem for two days . The problem is that i am trying to hit a webservice from localhost .
Just for testing purposes i wrote this code and it ran the way it was supposed to :
<a href="">Save</a>

As you can see , everything is static and it works like a charm because i see something like this on the browser :
Now i need to extract the img element from it but i have no idea in how to go about it .
I tried using jquery like this :
$(document).ready(function() {
			alert("hello again");

Now i only see the alert("hello") as a pop up but nothing inside the function call and on my browser i see this
"Origin http://server_name is not allowed by Access-Control-Allow-Origin."
Please help
Posted 27-Oct-12 5:39am
Updated 27-Oct-12 8:16am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

As I see, this is a cross-domain call. Thus a simple getJSON won't be enough. Consult the legacy ajax[^] method to see how you have to set parameters for a JSONP call.
Member 9459463 27-Oct-12 13:08pm
Zoltan , i read the jsonp a bit ( i forgot to mention i am fairly new ) but according to that the server side code which i need to call should have a function which i could call . If that is the case then i cannot call the function as i can't change the code at that side . Am i right ?
Zoltán Zörgő 27-Oct-12 13:15pm
Not absolutely necessary, forget JSONP for a second, and try it as a regular json call, but with CrossDomain settings. Shoul work.
Member 9459463 27-Oct-12 13:19pm
How do i do that ?
Zoltán Zörgő 27-Oct-12 15:46pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170728.2 | Last Updated 27 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100