"AJAX" - Sending But Don't Need Response?
Mar 6, 2006
I have a situation where I want to send data, but I have no need for a
response. It seems to me that XMLHTTPRequest is the best way to send the
data, but I don't need any response back from the server.
Basically, I'm writing js errors to an error log on the server side -
and there is no need to inform the user that the error has been logged.
The problem is that I don't want to sit with the request open & waiting
for a response, when I have no need for the response. I suppose I could
have the server respond with just "OK" or something like that, but it's
really not relevant
I was thinking of just aborting the request on readystate=1 (at that
point, the server-side script should have executed already, right?), but
I was wondering if there were any other methods to JUST send..
View 20 Replies
ADVERTISEMENT
Sep 6, 2009
this is mohan started working recently on ajax with struts2 framework. I can able to make a ajax request to an struts2 action class.But in the response I am getting the whole jsp page as a response mentioned in the result tag in struts.xml file.But I need only the partial data like array or list etc from the action class.
View 2 Replies
View Related
May 17, 2010
I have an ajax post which returns a large html response. It is getting truncated at 98784 characters everytime. Is there a limit to a response size or a way around this?
Using: IE7
jQuery 1.4.2
jQuery UI 1.8.1
Here is my ajax call:
View 1 Replies
View Related
Nov 8, 2009
I am an avid php developer and i am starting to get into ajax so i can keep file sizes and code down to a minimum.
I am looking in the w3schools ajax examples but i am a little lost at how to send through a variable to the page i am using to process.
What i would like to do is send through an id that is being recalled from the database to tell it what to save over.
ajax:
View 4 Replies
View Related
Dec 9, 2009
My server has an xml configuration file which I want to receive to my browser. I can do HTTPrequset directly to the file config.xml and get it in the responseXML, but I want to do it im more secure way, so the post request will be to some script ("python" in my case), which will open and read the file.
If my xml file looks like this:
What shoud be the content of the response?
View 4 Replies
View Related
Nov 16, 2006
I'm having a weird problem, not sure if I'm overlooking something or leaving something out. I'm trying to send values of a form to through AJAX to a php script then return a value. It works fine, except the author field is always blank. I've created a simplified version and it still works weird.
This is the javascript used to get the values and send them, when they come back the alert message shows Name as blank. I've looked in the PHP file to see if I made a mistake but I don't see anything.
function postComment() {
var author = document.getElementById("author").value;
var email = document.getElementById("email").value;
var comment = document.getElementById("comment").value;
var url = "includes/testComment.php";
request.open("POST", url, true);
request.onreadystatechange = showResult;
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
request.send("author="+escape(author)+"&email="+escape(email)+"&comment="+escape(comment));}
function showResult() {
if(request.readyState == 4) {
var message = request.responseText;
alert(message);
}
}
HTML Code:
<form>Name:<br />
<input type="text" id="author" name="poster" size="25" /><br />
Email:<br />
<input type="text" id="email" name="email" size="25" /><br />
Comment:<br />
<textarea cols="36" rows="7" id="comment" name="comment"></textarea>
<input type="button" onclick="postComment();" name="submit" value="Comment" /></form>
PHP Code:
$author = trim($_REQUEST['author']);
$email = trim($_REQUEST['email']);
$comment = trim($_REQUEST['comment']);
$response = "Name = ".$author." email = ".$email." comment = ".$comment;
echo $response;
View 21 Replies
View Related
Oct 15, 2006
Some servers return JavaScript as the response to an AJAX request. When
the response JavaScript is eval'ed it calls other JavaScript functions
already in the browser to update elements, etc. This seems like a good
system because it allows so much freedom in creating the desired
behavior in the browser. The required data doesn't have to be converted
to XML or JSON on the server. The browser doesn't have to have
templates for interpreting and converting this data into some change in
the browser. All of the conversion algorithms don't have to be written
and changed when new behavior is required. This remote procedure call
approach is the predominant system in the Ruby on Rails world.
(Unfortunately they are calling Prototype.js functions.)
However apparently some people seem to think this remote procedure call
approach is a bad idea. I can't see why it is so bad because it is so
lightweight and flexible. It also helps to keep the client less
intellegent which seems good in a world of incompatible client-side
bugs.
If I use some neutral data format like XML to accomdate different types
of clients then I have to write different client-side interpreters for
each type of client (browser, RSS, POP, cell phone, etc). Why not just
write different server-side code that generates the correct JavaScript
(or other) for the requesting client type?
When is the RPC approach such a bad idea?
View 5 Replies
View Related
Feb 24, 2007
I am using ajax / php where I am looking up some info from the
database and populating a select list dynamically, however I am
running into some sort of size limitation with the ajax.response
object. If the string I am passing to javascript from php is too large
javascript does not get it all the data. The magic number appears to
be 6123 characters, anything below that it works fine, anything above
and if I alert the ajax.response, I see the string is cutoff. Any
ideas where this limitation is defined?
View 11 Replies
View Related
Nov 15, 2008
I am using following code
Now what i want to do is: i have a callajax() function. with in this function i will call do_login() function. this do_login() handles an ajaxrequest and returns the responsetext.
Now i want to do some validation on this responsetext(in case of onsuccess). so i am trying to return value to callajax() function for onSuccess case in ajaxrequest.submit();
That is(onsuccess response) supposed to be some string( but not true or false). but i am always getting false in ajaxcall() function. i know the do_login() function is returning false before ajaxrequest completes
So i want to stop this and make do_login wait until ajaxrequest completes and then i want to return it's response to callajax() function.
View 3 Replies
View Related
Apr 3, 2008
I am wondering how possible it is to use eval() to parse javascrpt that is pulled in through ajax(innerHTML)? I have found a few notes about this, such as:
Code:
var myObj = eval ( xmlhttp.responseText );
View 14 Replies
View Related
Jan 24, 2010
I'm trying to send two arrays to an asp.net mvc method using ajax. The two arrays come from the values of two lists of checkboxes.The problem I'm having is that I don't know how to send them both at the same time. Here is my code at the moment:$
(
"#sendAjaxButton").
click
(
[Code]....
The asp function needs some way to differentiate the two arrays.
View 5 Replies
View Related
May 12, 2009
I am doing xmlhttp ajax stuff. I am using a script called "SEXYALERTBOX". I am using it to allow the user to input a password. The textbox is called BoxPromptInput. I do not think its inside a <form> tag.
Here is the code:
function askForPass() {
Sexy.prompt('Please type the password in order to see the pictures/videos','' ,{ onComplete:
function(returnvalue) {
if(returnvalue) {
var xmlhttp = false;
var pageResponse = null;
try{xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");}
catch (error){try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");} catch (error) {xmlhttp = false;}} .....
Any way to pass the value since I am sure the request.form would not work in this case since its not in a form.
View 1 Replies
View Related
Feb 3, 2011
I'm trying to work a way out on how to send multiple params via post using ajax. but the amount of params can change everytime, i know how to create the param string but how would the post page handle the different amount of them, is there a way to loop and recieve each of the params that get sent?
View 1 Replies
View Related
Aug 18, 2011
I will explain this the best way that I can. I have a form that can be filled out and once the submit button is pressed, a lightbox pops up to prompt a thank you page. The thank you page is called verify.php. Basically when the user fills out a form and presses the "submit" link, a lightbox pops up saying "thanks". I need the form values to be displayed in this lightbox. Since my values aren't actually being sent using the POST method, the verify.php is does not show my confirming value box (ex: Thank You Brad Heckle (this is the $fullname variable) for submitting an application.). This verify.php is called using AJAX and displays without loading a new page on the index.php when "submit" is pressed. Since php needs the variable to be passed through the POST method so that it can grab them, AJAX is causing some problems.
Code:
<script type="text/javascript">
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox({[code]....
Do I need to post the facebox.js that is the lightbox code which is linked to this page?
View 14 Replies
View Related
Apr 12, 2006
In my browser, I make an AJAX request. The server sends me a fragment
of an HTML document. That fragment has some JavaScript inside some
script tags. How do I run these scripts when the fragment arrives at
the browser?
View 12 Replies
View Related
Aug 27, 2010
I am making a call like -
$('#display').load(adnwurl, function(response, status, xhr) {
alert(response);
});
And also tried with -
$.get(adnwurl,
{},
function(data) {[code]...
In both the cases I am getting an empty response instead of expected html response.If I just copy paste this adnwurl in browser, I do get a proper html response. Its not working with ajax call.
adnwurl = "http [url]...site_id=4764&partner_id=70606a913077034c&timeout=5000&version=1.5&language=jsp&format=wap&testing=1&target_params=AGE=>29||DOB=>1981-08-[code]....
View 3 Replies
View Related
Dec 22, 2010
I'm using $.ajax for an ajax request and I've setup a basic html form and if there are errors in the form when the user submits them my server side script is returning them in an array to the client with the errors.
If there are multiple values in the array, how do I display each error on its own line either using <li> tags or even just a <br/>? I'm injecting the ajax response into a div using .html() but how do I iterate the array within that div so I get one error message per line?
Do I need to construct the HTML on the client side after the ajax response has come back or should I do this on the server side before the data is even returned to the client? Right now I'm returning a raw array so that is why I'm asking the question about how to format things up and get the form errors into my div.
[Code]...
View 1 Replies
View Related
Aug 28, 2009
I'm truggling with this for a while now, without succes. Here is the
[Code]...
View 1 Replies
View Related
Sep 7, 2009
I'm making a ajax call using $.ajax
[Code]...
View 2 Replies
View Related
Feb 10, 2009
I have a simple ajax request that is supposed to (after a short timeout) redirect the page to the URL that the server sends back but it just wont work. It does work without the setTimeOut() function however.
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
function go() {
var u = "http://site.com/";
http.open("GET", "go.php?" + "u=" + u, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
var redirURL = http.responseText;
setTimeout("window.location.href = redirURL;" , 2000);
} }
http.send(null);
}
View 2 Replies
View Related
Oct 6, 2010
i have wriiten a form in my php page and i did call an ajax function on onsubmit, based on my ajax response my form have to be submit...but i am not getting ajax response text some times. But some times i got it correctly..i have used post method in my ajax function.
formid="reserve";
var f = document.getElementById(formid);
var keyValue = "";
keyValue = buildKeyValueSearchFunction(f, keyValue);
alert(keyValue);
ajax_request = createRequestObject();
[Code]...
View 3 Replies
View Related
Feb 15, 2011
I am using ajax to process a url. The result echoed back is
ok=true how can I convert that to json format so I can read that back in?
I can't edit how the response comes to me.
View 1 Replies
View Related
May 5, 2010
I am running the scripts below which should return a string containing a URL. So far, it cannot find the form contents in Firefox, but displays the non-dynamic data such as ?Location=. It won't work at all in IE.
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
[Code]....
View 2 Replies
View Related
May 18, 2006
Is it possible to upload FILE from form by AJAX ? I capture values on form field and send by ajax call and all works perfect, but when i try upload file it doesn'work. Maybe wron header is set? What do you think of that?
View 2 Replies
View Related
Jun 30, 2009
Posting data from a form using this function:
[Code]..
the server doesn't detect an ajax call ('X-Requested-With' header is not sent). I tried forcing it with beforeSubmit and also with ajaxSetup, but no go.
View 10 Replies
View Related
Oct 20, 2009
i made this little script ->[URL].. After the list is completed i would like to send the list (as json string) with ajax. Is this a good solution?
My other idea is that i manage the list with php.session and ajax... but i don't know...
View 3 Replies
View Related