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 have a TreeView populated from a SQL Server database (via an XML doc). The TreeView includes checkboxes on each branch and leaf. Each entry on the TreeView may or may not inherit access permission from its parent. That is, if you're granted access to branch "A", you automatically get permission to leaves "A1", "A2", and "A4", but not to "A3", as its inheritance flag is set to false.I have created an array of struct's on the server-side.
Struct format is:
public struct TreeInheritData { public Int32 namespaceID; // this identifies the node
[code]...
The array is populated with these structs.The TreeView I'm using (from Infragistics) has a client-side event when the CheckBox status changes.So, what I need help on is getting this array of structs from the server to the JavaScript, and then being able to access the structs so that I can determine whether to change the status of the child nodes' checkboxes.
I have a few values and variables that I want to post to a server (without using a SUBMIT button). Is there a way to post data from within javascript - do sockets or connections have to be open for this to work?
You can use JQuery's data method (e.g. $('#MyID').data('MyVar', 'MyValue');) to easily store/retrieve information.
However, I was wondering if it is possible for my PHP generated page to add HTML tags that initialize the JQuery's data method variables. Regularly, I want server side variables to be accessible client side. It would be very helpful if I could initialize data method variables during PHP page generation.
If this is not possible, are there any suggestions on how to efficiently communicate server side variables to client side?
I know that Javascript is client side, but I'd like to know the best way to populate HTML drop downs in real time based on information typed in the other HTML form fields with information found on the server as opposed to the client.For instance if a user wants to select certain files located in a directory on the server, as they type in the pathname supposedly containing the files the drop downs continually refresh themselves with the server files listed in that directory (if it exists, and apache has permissions to see what's inside) as if it was showing client files instead.
What would be nice is if my browser could continually query the server for some of its private information and not have to refresh itself to obtain it, whether that means the server-side would have to continually refresh itself makes no difference to me as long as the client-side doesn't have to. But I guess this is not possible because no matter what you would have to at least refresh the client-side page once?Submitting the form to a CGI or PHP script would not work because I need this functionality to help populate the form BEFORE I send it.I would like to not have to press a button to update the form every time I change the pathname and need to update the drop downs since this would be annoying.
I am doing a password reset form using Jquery and PHP. If I try to submit an email id it should sent and email and report back the response text as success so that the user knows email has been sent. But I am stuck with JSON submit as I have an empty array to decode at the serverside. I am using minified version of json2.js from the official json.org website
Here is the code. Code JavaScript: var formdata = $("#log-box").serializeArray(); formdata = JSON.stringify(formdata); var notifymsg; alert(formdata); $.ajax({ type: "POST", url: "forgot-pass.php", contentType: 'application/json', data: formdata, success: function(responsedata){ var some = responsedata.split("&"); $.each(some, function(index,value){ //alert("index="+index+"value="+value); }); }, error: function(o, s, e){ alert("Form not posted "+e); }}); formdata alerted gives: [{"name":"email","value":"ravi.k@gmail.com"},{"name":"acctype","value":"loginaccount"}]
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,
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.
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.
I have a script that writes to an IFRAME, it writes dynamically and then needs to reload it server side. Anybody knows how to do it? I'm joining the code of my attempt but it appears to be reloading the IFRAME on the client side therefore causing an activeX error since I am running this in FireFox:
I have a form field that needs to be validated in a hidden Iframe which is driven by Coldfusion. Which is working fine. But the same form field also need do some client side validation as well if Server side (iframe) validation passes.I thought I could create a javascript function, in it call a server side validate and then client side, but without any success. It does not process in the order as expected. Javascript always go first, then the server side validation.I tried to delay the client side with time delay, then server side did process first, but client function could not recognize the parameter passed.here is the function:
Function doValidation(param1,param2,param3,param4) { ....
I have written a custom slideshow script which gets the images from an array... The script will change the src of a img, which is a fullscreen background. Now here's the problem, I've been trying to write a function where can define a folder "gallery est", and then get all image files in that folder and repopulate the slideshow array. So, is there a way to scan folders? I've searched around and found some solutions where PHP is used, but i really want to keep this pure js, if possible (?)