I am using PlainAjax. [URL] Here is my code and it is not working if i called from Javascript function.
<script type="JavaScript" src="plainajax.js"></script>
<script language="JavaScript" >
function openWin()
[code]....
But i am not able to get any value in my php program. or is anyother way to pass the variable from Javascript (except pass thru url query string, this is not secure)
how do i pass values back to javascript from the server via ajax? I don't want to pass entire html. Is there any way to simply pass a JavaScript object or an array without stuff like xml and json? I could probably do an eval() on the result to convert it to a javascript understandable array, but maybe there's a more clever way to do that?
I'm trying to write a script that will be loaded from one server into a website on another server. This script is trying to talk (ajax) to the server that it comes from but I'm getting "Access Denied" errors. I'm well aware that cross-domain calls are not allowed for security reasons so my question is how does Google Analytics work because essentially thats what I'm trying to accomplish. I can embed a Google Analytics script into my website and it'll gather data and send it back to Google.
I have a web page that displays records from a database. I want to allow the user to specify his own "page size" - that is, the number of records to be displayed on a given page. I have a place set up for him to enter a value and save it to a cookie. My problem is, I can't figure out a good, simple way to pass that value back to the server.
The page is accessed in various ways: it's first viewed by selecting it from a javascript menu. Then the page itself contains a form with a series of buttons that allow the user to jump to a specific page above or below the current page. There are also "sort links" at the top of the columns of data which refresh the data sorted in a different way. In all of these cases, I will need to pass the page size back to the server.
I tried storing the page size in a hidden input field. This works but it's not available on the first request (from the menu). I thought about passing in the value as a query string (mypage.htm?PS=123) but I can't figure out how to attach the value to all of the various requests (menu, form and links).
I know at this point is that these is a difference in the array formatting between PHP and JS. The magic bullet is supposed to be json. However, this code does not work as advertised.
[Code]...
The variable $prt is list of associative arrays, so to get a value in a particular row manually , $prt[0]['location'] should give me the value for location in the first row of output. All of this works just fine if i hard code this in html and php. However, I want to dynamically produce the rows as needed which requires that a loop employed. The application also requires that the user may add a row which also need to be accounted for when posting.
I think the best solution is to make this a totally javascript entity. All I need to do is to be able to pass in the server side data. Calling JS from PHP does not work, although i have found many places where they show basically the same code , claiming that it works. think json needs a bit of tweaking to make this happen, but i'm not sure how to proceed.
how to pass javascript variable values to server side code i used a hidden field and passed he value in it . i do get the value in hidden field but on using request("hdfield") its blank how do i get the value frm javascript
I am trying to pass an argument to a function to process server responses. My original line of code looked like this: [url]
This works well enough as is, but I am trying to pass arguments to the function, and everything I am reading says to contruct the code like this: [url]
Every example I have come across uses this same approach, but I keep getting the error "Expected ';'" pointing to this line and then the code fails to execute. I just cannot see where there is anything missing, and it looks pretty much identical to my examples.
I have also tried replacing the call to the function with the actual code in long-form, and the result is the same.
where someData is a vanilla object of key/value pairs, submissionUrl is a valid URL and ajaxSuccess/ajaxError are both functions.Using jQuery 1.5.1, the GET request is delivered to the server without the data. Using jQuery 1.4.4, the request contains the data.Has something changed in the way I should be assigning data to an ajax request in 1.5.1? The docs don't seem to suggest I'm doing anything incorrectly.
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>
AJAX is a rich client-side technology that makes the web pages more interactive. In practice, the same AJAX client-side code should be unchanged, regardless of what server-side web technologies we use. I guess this is same concept as traditional front-end plain html code that can work with different server-side web technologies for back-end processing.
Similarly, AJAX should be server-side independent concept, is that correct? But if this is the case, why there are different AJAX frameworks available for different server-side web technologies such as Java, PHP? We should simply just use generic AJAX server-side independent framework for our AJAX-enabled web applications.
I wonder what server-side technologies that google maps/gmail use for their AJAX front-end?? I guess google maps/gmail can be good AJAX models to follow?? What do you think?
I know about the same-origin policy and that one of the only ways to load data from a cross-domain is to load it as JSON. However, all I am trying to do is access data from a server on another port (which I believe the browser still treats as cross-domain). I need to do this because the server my application is on is a map server and the other server (Apache) is the only one that can handle php scripts. I have also tried out the plug-in from [URL] and while it works when I do $('#phpContent').load('http://www.google.com'); it doesn't work when I try $('#phpContent').load('http://localhost:80/mapScripts/getFiles.php'); I have also tried$.get('http://localhost:80/mapScripts/getFiles.php', function(data) { $('#phpContent').html(data); });
So here I am breaking my brain and do not know what else to attempt.
I have an application running on a non-interactive kiosk that I need to keep updated with information that will be provided by a remote server. To do this, I've created an XMLHttpRequest/Microsoft.XMLHTTP object that checks the modified date in the header of a watched file that resides on a remote server.
This function runs on an interval, and if it detects a change in the modified date since the last check, it retrieves new information from the remote server.
I need to send 15 requests to my server and get results, these results are queries to other sites. I then update my page with the results. I need to know if I am taking the correct approach, as things are working a bit slow, and i.e., seems the be as slow as a snail.
Here is my function for the first request Code: function one(){ var xmlHttpa=null; try{ xmlHttpa=new XMLHttpRequest(); } catch (e){ try { xmlHttpa=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e){ try { xmlHttpa=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
xmlHttpa.onreadystatechange=function(){ if(xmlHttpa.readyState==4){ document.getElementById('resulta').innerHTML = xmlHttpa.responseText; var el = document.getElementById('showMessagea'); el.parentNode.removeChild(el); applystyle(); }} xmlHttpa.open("GET","one.php",true); xmlHttpa.send(null); }
I then call this function and others from my page, one(); two(); etc. Am I correct in my approach?
I have a table that gets served off to a 3rd party site. Each row has "track" and "hide" checkboxes ... I need to save/update these settings as the user updates their settings so I can call them back later on future visits.
(cookies are not an option... because that is too easily lost and there could be thousands of settings over time)
So, I am leaning toward a AJAX POST using Jquery. Rather than submit on every change... I would like to store the settings in JavaScript and then batch submit every 30 seconds or on page unload. I have most if this working... it is the saving of the data and then batch submission code that I am after.
Let me give you the use case and a scenario:
Table with 100 rows and each row has "track" and "hide". Each row may be associated with one "subject" and multiple rows may have the same subject ... so when you track or hide... it tracks multiple rows (highlights, checks their boxes, and grabs the subject from a row field) OR it "hides" multiple rows based on their subject.
All that is working. (Yes!)
Now, because they could be clicking quickly through... they might track then "untrack" the same subject or hide then "unhide" the same subject all within a very short period of time.
I don't want all those AJAX calls!
So, I need some sort of data storage for the "subjects" that puts them in "track" and "hide" datasets ... removes them out if undone ... and occasionally submits whatever the queued up actions are (if any).
Also, there may be settings grabbed on page load that need undone (the track and hide setting grabbed from the DB that pre-dated that visit) ... so it may not as simple as removing from a data set... there should be an explicit "untrack" & "unhide" submission in those cases to update the DB.
I have an ajax script that sends a request to a servlet for information to be inserted into a table cell. The servlet then handles the request and replies with something like this:(I took the liberty of removing all the out.println tags)
For some reason, however, all the scripts functions cannot be found on the page. If I attach the <script language='javascript' src='whiteWine.js'></script> on the page then the functions work, but they are used as polymorphism and incorrect information is shown. (There are 3 different scripts with the same named functions, but different implementations).Is there a reason why ajax can't send across scripts?
I want to load some pages generated with the server (ASP) and assign their html results to JavaScript, so users could click the links and the content of any selected page would show up immediately, making no requests.
So, I have one main page called mainpage.asp which, I think, should get all subpages with content, names are subpage1.asp, subpage2.asp, etc. I tried ASP's XMLHttpRequest to get content of all sub pages and assign html result to JavaScript variables. But I realized that MS XMLHttpRequest does not get session protected pages. I mean that if my subpage will generate output with session only, then even if the session exists, MS XMLHttpRequest does not see it.
Anyway, this trick did not work. If I include these subpages in mainpage.asp under a hidden field, this may be a solution but I do not see it good enough yet.
What would you recommend? How would you assign subpage's html code to JavaScript variables or array of variables?