JQuery :: Ajax Call - 403 Forbidden If URL In Content
Oct 15, 2010
Strange behaviour: User enters text into textarea - text includes URL with protocol e.g. [URL]. JSON call fails with 403 forbidden. It seems the the serialised content is being interpreted as a cross domain call (my guess). Any other text works - Even if the user enters "http://www.u", but as soon as the input qualifies as a url, I get a 403.
The code extract:
var formText = $("#contributioncontrol").serialize();
$.getJSON('[URL]',formText, function(response) {
if (response.ERROR != true) {
var output = response.HTML;
$(output).hide().prependTo("#results").fadeIn("slow");}
}
If the user enters http://www.url.com in the textarea on the form then The request looks like this: [URL]. The '/' chars in the line above are replaced by% 3 A % 2 F % 2 F (without spaces - Don't know how to stop browser interpreting the encoded stuff).
And the response like this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /API/createcontribution.php on this server.</p>
<p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.</p>
<hr>
<address>Apache mod_fcgid/2.3.5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at www.mysite.com Port 80</address>
</body></html>
View 1 Replies
ADVERTISEMENT
Jun 14, 2009
Dynamically loaded content (via JQuery's get method, for instance) seems unable to connect to a stylesheet that resides on the main page. I understand this is due to the fact that the dynamic content is not part of the DOM.
View 1 Replies
View Related
Dec 6, 2010
I am having a problem of calling the user defined JS function after I make the AJAX call. Basically, I created couple radio buttons on the main html page. When the user clicks on one of the radio button, it will trigger the AJAX call and return another html file in the "div" content that I set in the main html page. The other html file contains a user defined JS function (e.g. "updateContent()") which use the onclick event handler to call the function. When I'm running the app, and click on the button. I had seen the firebug was complaining the "updateContent() is not defined" error. The function itself works fine and must be defined properly.
Here is the code in the main.html page:
Code:
<script type="text/javascript">
var asyncRequest;
function getTools(url){
try
[Code].....
View 1 Replies
View Related
Dec 6, 2010
I am having a problem of calling the user defined JS function after I make the AJAX call. Basically, I created couple radio buttons on the main html page. When the user clicks on one of the radio button, it will trigger the AJAX call and return another html file in the "div" content that I set in the main html page. The other html file contains a user defined JS function (e.g. "updateContent()") which use the onclick event handler to call the function. When I'm running the app, and click on the button. I had seen the firebug was complaining the "updateContent() is not defined" error. The function itself works fine and must be defined properly. Here is the code in the main.html page:
Code:
<script type="text/javascript">
var asyncRequest;
function getTools(url){
try
{
asyncRequest = new XMLHttpRequest();
[Code]..script type=
View 18 Replies
View Related
Jan 30, 2011
I am sending a string to my server from my javascript program by:
function sendContext(){
try {
$.ajax({
type: "POST",
url: "http://localhost:50563/Myserver.svc/ReceiveInfo",
data: jsonContext,
[Code]...
View 2 Replies
View Related
Jun 23, 2010
I'm getting some strange behaviour when calling my test WebService. I get the expected response when testing with IE7 & 8, however with both Chrome and Firefox I'm getting a 403 error.
The Service is called via
Code:
if(window.jQuery)
{
$.ajax({
type: "POST",
url:
[Code]...
The service and test web site are both running from the same domain (a local webserver) with the service on port 7000 and the test client running from port 80. Does anyone have any idea why this service might be responding correctly to IE and not Chorme?
View 3 Replies
View Related
Dec 14, 2010
The general framework is a simple user login function. The user name is selected and a password entered as usual. The function grabs the element values and passes them to a php page that queries the database. An AJAX call returns the password to the function and then I want the innerHTML to be a choice of two web pages, depending on success or failure of validation. There are existing AJAX functions available on the internet but they are overly complicated for what I think should be a simple, quick to load function.
Where I am stuck is that the standard procedure to make an AJAX call is the browser window event. How do you make the call from within the function? I have tried creating two new variables, "success" and "again" to replace xmlhttp, but still stumble on the event to assign a value. I left the blank password protection (if statement) with that variable to demonstrate what I mean.
I've put in my code below, which is in development and successfully alters the innerHTML text depending on user input but I can't figure out how to insert the relevant php page. I have '// out' the testing bits, but left them for info. (I have tried full 'scripting' as the innerHTML, but it's messy.)
View 4 Replies
View Related
Mar 25, 2009
I'd like to call a function to check if a div with id content has a <h1> tag and if so change the divs background colour.
View 7 Replies
View Related
Mar 16, 2011
I wrote the following code with Dreamweaver:
If I run it in Dreamweaver It works and the alert success is raised, but If I run this code into Safari or Chrome the Error alert is always raised.
View 1 Replies
View Related
May 10, 2011
My goal is to get some HTML content including some UI widgets and other stuff via an ajax call. To clarify my goal and the strange behavior, I attached some HTML files, that you can run for yourself. Open the index.html will show you some UI widgets, which are pulled from the ajax.html via ajax. When you scroll to the bottom you can see the same content inserted a second time. But this time, the widgets are not "rendered". It looks if the "button()" calls etc. are not executed.
The only difference is the way I insert the result of the ajax call. The first time I insert the hole content received by the ajax call, the second time I only insert the content of a special div. The goal in this is to get various chunks of content with one ajax request and replace "div#one" and "div#two" with different parts of my site. Which is not working. Is it generally okay to receive html content which has some script parts to be executed via ajax and what is wrong with my second approach?
View 1 Replies
View Related
Aug 9, 2009
I'm currently using the dialog functionality (modal form) from UI library to submit data to the database. All the validation checks have been running ok until one of the validation checks requires a ajax call to check if a username exist in the database. I'm fairly new to both javascript and jquery so this could be a fairly basic blunder. Initially, i thought it was an synchronicity problem, but I changed the $.ajax async option to true but still no joy, so maybe it something to do with scope etc?
Here's the code:
function checkIfUsername(){
$.ajax({
type: "POST",
url: ""+CI_ROOT+"index.php/admin/check_if_username",
data: ({username: username.val()}),
async: false,
dataType: "json",
success: function(data){
returnUsernameBool(username, data);
}});
}function returnUsernameBool(o, data){
if(data.bool == true){
o.addClass('ui-state-error');
updateTips("Your username must be unique");
alert('false'); //this works
return false; //still can't return bool
}else{
alert('true'); //this works
return true; //still can't return bool
}}
bValid = bValid && checkIfUsername(username);
alert(bValid); //still gives undefined
View 5 Replies
View Related
Sep 6, 2009
I am trying to set an html attribute after an AJAX call. Works great on the initial tab I can't get it to work on the rest [code]...
View 1 Replies
View Related
Jan 25, 2011
Is it possible to get a return value from a page call within an ajax call? For example,
$("#new_request").click(function(e){
$.ajax({
url:"_insert_new_request.php",
type:"GET",
[Code]....
Here I make an ajax call from a click on a div. I then call "_insert_new_request.php" page, with a param of "partner_id_link".
Can I return a value from the "_insert_new_request.php"? and how?
View 1 Replies
View Related
Jul 6, 2010
I am planning to use an AJAX call to a PHP script that accesses a REST servlet. My php script would be very simple; something like:
[Code]..
I'm an experienced programmer, but I'm fairly new to web development, so I am having trouble interpreting this error. What have I done wrong? Is this the proper way to call a PHP script with AJAX?
View 1 Replies
View Related
Apr 9, 2011
I have a page that creates one unordered list from the contents of another list. The second list is created from a database query and is hidden on the page. I have written a JQuery function shown below that does an AJAX call which causes the hidden list to be created and that is working perfectly. The problem is that when the code following the AJAX call is executed it doesn't see the hidden list. The alert message displays 0 the first time. clicking on the Load button a second time results in the first list being displayed. If I click on the Load button a third time, the previously loaded list is displayed; click on a fourth time and the new list is displayed.
In other words, it takes two cycles to display the correct list. I am at a loss as to what might be the problem. Other than this issue the code does what I need it to do.
$(function() {
View 2 Replies
View Related
Jul 5, 2010
i have a set of select fields, which when selected, send a value via ajax, to return a sub-selection for further choice. I have 3 levels of sub-categories like this. For some reason it works in FF only - not IE. [URl]..
View 12 Replies
View Related
Feb 16, 2011
I am using an ajax call when clicked on a link... It asks whether you want to continue or not and if you say "ok" then it uses a perl script to delete something from the db.[code]So I was able to call confirm on each of those links and if agreed use an ajax call to a perl script to wipe the user from database. The thing is that I had to usereturn false; in the end of my js call (after ajax) otherwise the link would take me to the script, which I dont want to. I want to remain at main level (to be able to see all users)... Now how do i refresh the page after such deletion? Lets image this scenario:
User clicks on link_to_delete Brad => confirm => he confirms by clicking ok => ajax call to perl script that handles the deletion of Brad => return false (I want to remain at index.pl) => HOW DO I REALOAD INDEX.pl ? I deleted Brad but I can still see him cause the page has old data.
View 4 Replies
View Related
Nov 16, 2010
I need to append a parameter during an ajax call: I was thinking about something like below:
The problem seems to be with the ajaxSend parameters. It seems that I cannot modify none of them:
View 1 Replies
View Related
Mar 29, 2011
I'm having problems with jquery and checkboxes..I've been trying and debugging for some time now, but I can't fix it.This is my current code:
[Code]...
View 4 Replies
View Related
Dec 2, 2010
How know that for ajax call to different domain applies the same domain policy, but is there anyway to get around this using the cluetip plugin?
View 3 Replies
View Related
Dec 28, 2010
I'm trying to write a modal login script which I borrowed from the SimpleModal site. Unfortunately, I'm running into a very frustrating problem.
When the user types in a valid login/password combo, the PHP function do-login.php echos back "OK". That being said, here's a snippet of my jQuery code:
$.ajax({
type: "POST",
url: "do-login.php",
data: str,
[Code].....
The do-login.php script DOES echo back "OK"- I verified that with Firebug. But even though it echos back "OK", it goes to the 'else' clause.
I tried using return instead of echo but that didn't help either.
View 18 Replies
View Related
Dec 4, 2010
I'm working on a weather api. A call to an internal PHP page GETs XML and returns JSON. However, I cannot get it to evaluate as an array:
(function($){
$.ajax({
type: "GET",
url: baseUrl + "weather_data/get_forecast",
[Code]....
Firebug (FF 3.5) displays the response in the JSON tagged perfectly parsed, but the code above fails.
View 1 Replies
View Related
Jan 12, 2011
I use $.getJSON for making an ajax call. This is the code.
$.getJSON("json/",
{cname:$("#customerNameId").val(),email:$("#customerEmailId").val()},
function(data){
alert(data);
});
The data is sent to the server, I also get a response from the server. My firebug shows the response as the value I sent from the server.
But the callback function is not called... The alert never happens
View 2 Replies
View Related
Jul 16, 2010
Suppose Server url is : [URL] and it returns json data I want to call this url using Jquery in iphone I wrote this code :
$.ajax { type: "POST",
contentType: "application/json; charset=utf-8",
url: "https://example.com/employee",
data: "{}",
[Code]....
Is this the right way to call this https request or I need to do some other authentication also Currently it does not work in iphone It return's json data in firefox,chorme,IE ,safari but doesn't return it in iphone
It returns valid json when i send request to http
View 1 Replies
View Related
Nov 12, 2011
I am trying to replace the names of each link in my html page with $f1 (Page) and replace some content with $f2 (Description).
How would I insert the data from this php file into my html page?
output.php:
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM Pages";
$result=mysql_query($query);
[Code].....
View 1 Replies
View Related
Jan 25, 2010
How to call a method from JS through UpdatePanel with jQuery? I cant call WebMethod cause it is static (I have a custom control and it is statically inaccessible).
What I have: Custom control on a ASP.NET website in UpdatePanel
What I need: User clicks on a link and JS does its magic and than I have to post (AJAX) changes to server (custom control). How do I achieve this with UpdatePanel (I cant jQuery ajax call) - how can I call a method on server with some arguments from JS?
View 3 Replies
View Related