I have a file system where users upload files. Using PHP the file is time stamped and that time stamp is saved in a database. This has been going on for months so I have a lot of files with server times saved in the database. Recently the client asked if the date/time could be displayed according to the client's timezone instead of the server's. So, I need a javascript function that will take a PHP formated date string and convert it to the clients time-zone.
So let's say there is a file with a date/time of 07/15/2004 1:15 PM in central time zone and the client is viewing the file today in pacific time zone (2 hrs diff.). I need to show that date/time as 07/15/2004 11:15 AM. I need JS to take གྷ/15/2004 1:15 PM' and somehow convert it to གྷ/15/2004 11:15 AM'. Code:
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 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?
How can I make the button call the click event so that the server side method btnExecute_Click() can be called? Also, this button calls a javascript function before server side even.
My login to the site is being processed using ajax, which does a redirect to the members page upon succesfull loggin in.The login feature however can in fact take a while because we need to initialise quite some data when a user logs in (his details, but also his privileges are loaded, his personal menu based on these privileges are being loaded, we are loading shopping cart info, we are initialising personalisation settings, and a whole lot more.It sounds like a big thing, but it isn't, and once logged in, the application is going great. the only thing is that the login proceure can take 3 - 4 seconds, and I would like to be able to show the client the progress of the serverside script:
"Searching your account..." "Validating your privileges" "Initialising your personal menu" blablabla...
To do this, I might just call an ajax call that starts the login procedure, and then issue another ajax call every 1 second or so to update the status based on some session variables I set in the login procedure and that I can serve to the client when th next ajax calls come in, but I would love for this to work a little nicer as in just needing to initialise ONE ajax call which can send back statusupdates from the server...
I am trying to write a string variable containing XML in the form of text into an iframe such that it shows up as formatted XML with the expand(+) and collapse (-) options that default in IE when opening an XML file.
The first thing I tried is writing the string to a file with .xml extension and setting the iFrame src to that file. This works well normally, however in this case, the file does not get created where I want to due to some security restrictions in IE which I cannot edit as I dont have admin rights.
Secondly I tried appending the string as innerHTML to that iframe but only the content within the XML tags without any formatting shows up which is not intended.
Thirdly I cannot use any server side scripting as this is a very controlled environment and I am not allowed to host servers or edit server scripts at will. This is totally out of question, so I guess Ajax or calling a costom defined web service wont help.
At best I can say, I am limited to HTML, Javascript and vbScript.
I am receiving the string as a responseText from an ajax request which is consuming a web service. If I use responseXML, it doesn't work.
The solution I am looking at is to either display it as formatted XML in an iFrame or to just throw it into a textarea which I am already doing and simultaneously write it to an XML file or do both. If not automatically, atleast have the user press a button and do it.
I want to send three text box values to server using jquery ajax. problem is that, i dont know the exact syntax to send three data. When i try sending one data(also change no.of parameters to one at server side method), its going good but when i try to send three text box values, its giving jquery error:"Internal server error". I think I am not sending data in correct way. Example below contains only two sending data, because i was trying to send 2 data first.
Below is the code:
function testCAll() { $.ajax({ type: "POST", url: "dbTest1.aspx/SendMessage",
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 am building a client-side and server-side solution and want to use JSON through Ajax in both directions. I have ASP or JavaScript server-side, though Microsoft's support of server side JavaScript seems nil, so I am reluctantly conceeding to use ASP. I'd appreciate suggestions on available solutions to encode/decode JSON on the server-side (ASP or JavaScript). I don't plan to load jQuery server-side so that rules out plug-ins. I'd also like to know what is the latest client-side encode/decode for JSON. Is it built in jQuery or a plug-in? In both server and client, decoding JSON securely is key, so using eval () to decode is out.
I am developing a web form using python cgi which has two list boxes. On selecting a value from the listbox1, the list box 2 should get auto populated with appropriate values (which are taken from the DB). I have written a javascript function to get the selected value from the list box1. But I am struck with passing the values from the javascript to the python function written in server side in which I have written the DB related stuffs.
I want to invoke a Client side javascript function and pass the value of the ID. How can I accomplish this such when a user clicks "Open" he goes to a new window with the same ID.
I tried this but it does not work: On Server side: sSql = "SELECT DISTINCT " + "'Action' = '<center><a href= 'javascript: NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+ CHAR(34)+)'>Open</a></center>',"
On Client side: function NewWindow(myID) { window.open("ChangeRequest.aspx?ID="+myID,"WindowName","width=500,height=600"); } </script>
I have the following PHP code, which uses server-side validation, which works fine. It the user leaves the text field empty it stores an error in a session array which is outputted on the page where the $_GET['id'] variable came from. I also implemented a snippet of javascript code that just checks to see if the cell is empty and throws up alert box. The problem is that both the javascript code and php error validation are both running when I click submit. The PHP code should be a backup to the javascript code in case the user has javascript turned off. The client-side validation should be the default. Not sure if this change should be made in my PHP Code or Javascript Code.
I have a web form that has a checkbox on it and a textbox associated with it. I want the textbox to be displayed when the checkbox is checked and I want this to happen on the client-side instead of posting back to the server. The checkbox is a server control (asp:checkbox...). I can write some codebehind that will display an alert message upon checking the box that looks something like this...
Page_Load...
Dim s As String Dim scriptString As New System.Text.StringBuilder
chkExpDate.Attributes.Add("onclick", "alertmsg()") scriptString.Append("<script language=JavaScript> function alertmsg() {") scriptString.Append("alert('hi'); }<") scriptstring.Append("/" + "script>" s = scriptstring.ToString()
Page.RegisterStartupScript("startup", s)
End Sub
I used this as a test to make sure the server control was running the script. But, when I change the script to assess the value of the server control checkbox such as checked = true, I get errors and if I just try to display the asp:textbox, it doesn't work either.
I had a import function which allow for user import data from excel file. The number of row was dynamic, mean that user may import hundred or data or may thousand of line.
should i perform client side or server side validate?
the problem i faced was if the import thousand of line, i need display out thousand of text (multiple by 6, cause 1 got 6 fields)
the take a lot of time to loading and cause browser "hang" (response slow)
I have the following client-side Content Management System VBscript which works great, now I'm looking at getting it to work server side so that I can update using online login rather than offline and having to upload files. To be honest, I have no idea where to begin with this,
However, this piece of Javascript uses some other script which is large.
<script src = "./js/tmp.js".....>
This will work if the file "tmp.js" is local. However this reduces the portability of my *utility* Javascript as users have to have that "tmp.js" for every webpage they have (if they want to use it :D)
I thought of uploading "tmp.js" it to somewhere and change my code to
I might be turning a corner today and seeing the light. I might still be confused :)
If JavaScript is the language for the browser then why do servers use Ruby/Rails, Perl/Catalyst, Python/Turbogears or PHP/Cake? Is it because the prototype-based language is too different to be chosen except when necessary. Is it because browser bugs make people think JavaScript is bad? Is JavaScript not suitable for the server-side for any reason?
I imagine that if server-side programmers started to learn JavaScript then the client-side code in the world might start to improve. Translation layer libraries like Prototype.js or Mochikit wouldn't need to exist. The more I learn about JavaScript the more I like it. It is difficult to learn however for multiple reasons.
Does Javascript work "out of the box with IIS" as an Active server page? ie. does it have the ability to open files ect.?
I tried this command and it does not seem to work.
var fileSys; var txtFile; fileSys = new ActiveXObject("Scripting.FileSystemObject"); txtFile = fileSys.OpenTextFile("./junk.txt",1,false);
I can't find examples on the web. What would I search for to find out about objects the Scripting.FileSystemObject?
Background:
I work at a large company with a corperate IT group. I need to write some server side scripts. The servers they have are Windows 2000 with IIS installed. If additional software needs to be installed I will be forced to use VBscript.
I have a number of server-side Javascript applications running on an old Netscape Enterprise server. I want to move them to Apache. Is there a way to do this without extensive recoding ? My code contains a lot of Oracle and SQL Server database interaction.
I'd like to adapt some Greasemonkey scripts that I've written and have them applied to html files on the server side before the files are sent to users. I'm only looking at adapting scripts that make static changes to pages. For instance, consider a script that removes from the DOM any img that has "ad" in its src.
I'm sure there are better ways to do this and I'm not even necessarily looking for an extremely efficient solution. Mostly, I just want to know if there's an existing product that could do this or with reasonable effort could be made to do this.
I want control a hardware device using a Web browser. I created a page which has a form containing all necessary INPUTs. By clicking a button, all current settings are sent to the server side (using POST or GET) so that the server can interact with the hardware, which is under the server's control.
Now, in some cases, I want to update the INPUT (w/ readonly) with the data from the hardware, such as a status value. Most primitive approach is creating a new page with new value to the INPUT, where I want to show the value.
But that is not quite efficient as the page appearance won't change except the contents of the INPUT.
As Javascript can make any change to the HTML page (at client's side) that is currently being displayed, it is more straight forward if the server can send a set of Javascript commands to the web server so that it can just update the display contents rather than refreshing everything.
I thought such scheme was already available, but so far, I don't see anything usable.
The Web server is not a commercial one but a custom Web server (written in Python) so that I want to keep the scheme as simple as possible. I checked AJAX but I'm not sure I can use AJAX in my application.