
|
Good Evening all
i am trying to post data coming from a form to the server and return a string , when i test this service works nicely. Its a Rest web api. now iam consuming it in Javascript Ajax like this
<script type="text/javascript">
function ProcessRegistration() {
jQuery.support.cors = true;
$.getJSON("http://www.mydomain.mymaindomain.com/api/Registration/Create", function (data) {
alert(data);
});
} </script>
When i run this and i get an Error
Failed to load resource: the server responded with a status of 405 (Method Not Allowed) http://www.mydomain.mymaindomain.com/api/Registration/Create
i have added the headers in IIS
"Access-Control-Allow-Origin" "*"
in my web config of the service i have added
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<...........
i have done all suggested by my research but i still get that error, try to restart the server but still the same.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|

|
Good Day
i have a web api that i want to call on the client side and return its contents, so it s a post and i return some string. Now i have a form that will have the data to be posted as depicted below
<form name="registrationForm" method="post">
and there are other controls within the form and i have a button that triggers the post as depicted below
< <input title="Register" onclick="ProcessRegistration();" style="width: 100px; height: 100px; align-self: center" type="submit" name="submit_fourth" id="submit1" value="register" />
onCick i call a function from the client side, the definition of the function is
function ProcessRegistration()
{
$.getJSON("http://www.mydomain.maindomain.com/api/Registration/Create", function (data) {
alert(data);
});
}
now when i click the button to fire the service i get the following error in the console
XMLHttpRequest cannot load http:
Does anyone know how to solve this ?
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|

|
Greetings and Salutations!
I'm not sure if this is the right group for this, but if not, please let me know where I should post my questions.
I'm a novice to the world of jQuery and I've run into a snag (and can use some help). When I include the following line in my HTML file, the element doe not slide down as expected:
<script>
$(document).ready(function(){
$("#ContentHeader").slideDown(4000);
});
</script>
When I load the page the element appears without sliding down. I'm self taught using CodeAcademy and a text titled: "JavaScript & jQuery: The Missing Manual". Do I have the syntax correct?
Here is the full code I'm using:
<!DOCTYPE html>
<html lang="en">
<head>
<link type="text/css" rel="stylesheet" href="JQSwaggerStyle.css"/>
<script>
$(document).ready(function(){
$("#ContentHeader").slideDown(4000);
});
</script>
</head>
<body>
<div id="ContentHeader">
<h1>Andre Mitchell Stevens Swagger</h1>
<h2>Ain't it cool???</h2>
</div>
</body>
</html>
=======================
Every experience in life is a lesson to be learned
A. Stevens
B.S., Computer Science
|
|
|
|

|
You haven't posted your CSS, but the first thing I would check is that you have display:none; set for your #ContentHeader element.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|

|
Richard,
Thanks for your feedback. Unfortunately that did not work. If I include "display: none" (without the quotes) the element doesn't appear at all (and I also tried using "slow" as the parameter, rather than "4000").
I also tried:
$("#ContentHeader").hide().slideDown("slow");
but that didn't work either...
Here is my CSS (so far):
h1, h2{
color: #FF8000;
text-align:center;
}
#ContentHeader{
background-color: #000040;
border-color: #FF8000;
border-style:groove;
border-radius: 5pt;
border-width: 5pt;
}
=======================
Every experience in life is a lesson to be learned
A. Stevens
B.S., Computer Science
|
|
|
|

|
You definitely need the display:none; . As Graham mentioned, you also need a <script> tag to include jQuery. If you don't have a local copy, you can use a CDN - for example:
<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
Here's a working example to play with: http://jsfiddle.net/Y5P7N/[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|

|
If that is your complete page, then you haven't included the script tag to load jQuery itself. It should look something like this:
<script src="jquery.js"></script>
The actual src= filename and path may be different.
|
|
|
|

|
Can anyone help me to do coding on the topic duplicate file remover.I am weak in coding and i am just a student Rahul
|
|
|
|

|
And are you hoping to do this in Javascript?
Veni, vidi, abiit domum
|
|
|
|

|
Yes.. i really need it.. Actuly it's my project... Can u help me??
modified 3 days ago.
|
|
|
|