In my php script (which is located at URL 'ships'), I am just getting
the value of 'variable' from the $_GET super global but I obviously
want that value to be dynamic and equal to the value selected in the
dropdown.
So the missing piece is passing the selected dropdown value from
HTML / Javascript to PHP. Anyone know how to do that?
this is the php file which return echos to the js files (there's no error here, I've posted this so you know what it's all about) [code]...
if a user writes in the text box for nickname a nickname that is already registred then in a text box near the input text it will appear something like : "This Login name is already taken!"
and so on for every field (firstname, lastname...)
I have done this previously with classic ajax tehnics (that with onreadystatechanged) and it worked. But this version does not. Can you spot the error here?
I'm using Prototype's AJAX to get the "alert" the response of a simple PHP script (a script that echoes a single line), but it doesn't seem to work. Here's the code:
function init() { var url = "http://localhost/script.php"; var myAjax = new Ajax.Request( url, { onSuccess: showResponse }); }
function showResponse(response) { alert(response.responseText); }
window.onload = init; The code has no errors, but still doesn't show the response even if i add an onFailure event handler. What could be wrong?
I'm grabbing an update from a json file, but I want to have it update perodically to the screen, overwriting what it found before... sort of like Prototype's Ajax Updater. Is this possible in Jquery? I scoured the groups to but only found a digg spy thing, which is sort of what I'm looking for but it was dated for 2007, so there's gotta be something new or is that it?
I've been working on some prototype and scriptaculous stuff for a domain management DB at work. I have all the areas working I that I need them too, and I have the InPlaceEditor working.. but all I need to do is get the 'saving' to the DB to work.
My dilema is on the form, there are 7 form fields. I have it set to that when the user clicks out of the text box, I want it to update the DB right then and there. So for each updatable item, I have:
PHP Code:
I set the options for the Cancel and Save button to be false and for it to update OnBlur. So the problem I run into is, I know how to update the DB with a full SQL statement, but to update them 1 at a time using this new AJAX features, I am running into some difficulties understanding the syntax for it.
I found this link at ONLamp.com and I think it's what I want to do, but not 100% positive.
Currently prototype does not support cross site ajax, such as dojo or jquery. This is unfortunate, cause I am really used to prototype and would like to use this functionality.
What would be the best way for me to implement cross site ajax for prototype.
Note that I will still need the normal ajax functions as well, so a nice extend or something would be good.
My code for submitting currently submits to my database properly and I get a really simple xml response either <success type=Ɔ'/> (fail) or type=1 (success) My question is this, given that I receieve xml back why does my code run all 3 onXXX methods? I can understand it running onComplete but not both onFailure and onSuccess. What events/factors determines whether these triggers are run? Code:
Is it possible to send an AJAX XMLHttpRequest using prototype.js API for a multipart/form-data ?
I already done parsing form parameters and sending GET/POST request, but does this work with <input type="file"> ? Who handle file submit and encoding ?
I want an identical effect that has three buttons -- print, email, text that does the same thing on the site.I can handle the server-side code (PHP), but I want to know how I can get that exact effect? My JavaScript is a bit above beginners, and I see they are using Prototype with some other effects.Now, on Firefox, I had saved the webpages but when I tried click on either of the 3 buttons, the JavaScript effect did not work. Can anyone show me how to implement something similar on my site?
What I have going on is an input box where they type in an account name. And the autocompleter works perfectly if they choose an item in the list.However, I want them to have the option of entering an account that is not in the list. And when they do this, the onblur event triggers the opening of the New Account box where they can fill out the new account information and submit the form back.Once again when a selection is made it works just fine, it's when the user creates a new account that it doesn't trigger the "getAccountInfo" function.
Simple ajax call seems to have some issues in Firefox. The "onComplete:" is called BEFORE the response is returned by the call. Is there a coding issue or a work around?
var ajax = new Ajax.Request( url, {method: 'post', parameters: params, onComplete: evalInfo });
function evalInfo( request ) { // do stuff with request }
Should I have a timer that checks the request state before exec the evalInfo?
I spent the best part of yesterday trying to get my form to be sent to the server however for the life of me I cannot figure out the problem. I haven't used prototype before but here is my code that I think should work perfectly fine,The php script works perfectly, i've entered test data into it and it makes a connection to the third party server using curl and then requests information that I get back i.e. the routing id comes back. But I cannot test the data using the form as the request isn't working for some reason.
According to ECMAScript, the root of the prototype chain is Object.Prototype. Each object has an internal property [[Prototype]] that could be another object or NULL.... However, it also says that every function has the Function prototype object: Function.Prototype, it confused me, because a function is an object, for a function object, what is its function prototype and object prototype..For example:
var x = function (n) {return n+1;};
what is the relationships of x, Object.Prototype and Function.Prototype
I am trying to get to the bottom of javascript object, prototypes etc. I have a fairly good grasp of it, but I get confused the closer I get to the base object.prototype. FIrst of all, I was under the impression that all objects descend directly from Object. But some objects (like Array) seem to inherit properties and methods from the function.prototype. So does this mean that the chain is like this:
object -- function -- array Second, I noticed (on the mozilla javascript reference site that object.prototype inherits properties and methods from function.prototype and vice versa!? How can this be? I must be missing something important about understanding the chain?
I was trying some Prototype experiments and got Event.observe to work with "click" and "change" events.
I wanted to do something similar with "key pressing". For example, detect when somebody pressed the RETURN and/or ENTER key inside a particular text field.
I couldn't find any docs on this. Does anybody have an example snippet?
One of the complaints about prototype.js (google for it if you're not familiar with it) is that it's poorly documented. I have this inkling that the key to understanding prototype.js is in the bind function.
The problem with Javascript is that the "this" operator is poorly overloaded and it is often hard to understand in the context of object-oriented javascript
As I read this, it states that all functions (which are themselves objects) will, in the future, have an associated method called "bind". The function() function, so to speak, simply instantiates a Function object with the parameter list and then evals the statement, sticking the resulting execution-tree in the current code frame.
The "this" there refers to the function object associated with the call to bind(), right? But the word "arguments" there refers to the arguments passed to the function object *generated by* the call to bind().
In every example within prototype.js, bind() is called either in a constructor or within a method contexted to a javascript object, and is always called with "this" as its argument, e.g.:
As I read the code it seems to be stating that the "this" object referred to within bind()'d functions are being coerced into always referring to the current instantiated object.
But isn't this always the case anyway? Is this a rather confusing attempt to ensure "this" purity whereby the call
method.apply(object, arguments)
is forced to always have the reference to the containing object present?
I think I've got it. Bind() generates uniq functions that contain live references to the objects to which they belong, such that the function object can then be passed to setTimeout() or onMouseOver(), handlers that accept functions but not objects.
Is there anyway to 'restore' the original alert() method or is it gone forever?
I know you can do window.alert = Window.prototype.alert, but lets say you also set Window.prototype.alert = function() { } or lets say we're in Opera, which doesnt have a Window "class".
I wanted to add an object as a prototype to separate my methods more nicely, however, I ran into a couple of problems. Apart from the obvious "scope" issues I found that any instances of my class shared the objects methods and properties.
I realise (now) that this is actually how prototypes work, they share functions and objects rather than create new instances of them for every "class", but is there any way around it? (or shouldn't I be doing things like this at all?) Code:
I am working on my own pop up calendar, mainly because the one I am currently using crashes the Safari browser at times.
So, I want to verify that what I am doing will work, in that I want to be able to have multiple calendars open at the same time, each independent of the other.
So, I start it off with:
var Calendar = { dateSelected: null, topPos:null, leftPos:null,
somefunction:function(e) { ... } };
If I create more than one calendar object, will they have their own variables, in that the dateSelected, topPos and leftPos will be unique to that instance?
Or, is there a better way to do this, that is cross-platform.....
In my research in the javascript language I have encountered problems with implementing prototype inheritance while preserving private methods functioning properly. Here is an example: Code: