I have to request data for a JS-script from a MySQL database (based upon a user-id).
I did not find a simple solution for JavaScript and it was not possible to load the data using ajax, because the database is available under a different domain.
I implemented a workaround using PHP and curl.
Now the JS has to "wait" for the request...
Howdy y'all,
I am looking for a way to include a .js function with in a straight php page. By straight php I mean there is no html included.
Explanation of process if you will.
I have a page where employees must swipe their ID badge for access to a computer.
The employee swipes the badge, the magnetic strip is read, and the data sti...
I am in debug mode, so I can see which page is being hit.
When I call either window.location or window.location.replace(..) it goes to the page, but then back to the originating page!
How could this be??
The solution was to add:
window.location.replace(...);
return false;
Why does return false make this work properly now?...
Is there a way I can run piece of javascript code ONCE without the use of boolean flag variables to know that it already ran?
Specifically not something like:
var alreadyRan = false;
function runOnce() {
if (alreadyRan) {
return;
}
alreadyRan = true;
/* do stuff here */
}
I'm going to have a lot of these types of funct...
newPercent = 15/30;
//result=Math.round(newPercent*100)/100 //returns 28.45
$('#counter').text(newPercent);
$('#howMany').text(count);
returns back 0.5% which is suppose to be 50.00%... how do I fix this? :S
...
I am trying to get a month range to insert into a CAML query, ie: 2010-09-01 and 2010-09-30.
I have used the following code to generate these two values:
var month = "10/2010";
var monthArray = month.split("/");
var startDate = new Date(monthArray[1], monthArray[0]-1, 1);
var endDate = new Date(startDate);
endDate.setMonth(startDate.ge...
Hello i have a problem. I have a page in which i have inside an iframe. In the parent page (not in the iframe), i want to build the browser buttons back, fw, refresh and home page.
The back, fw, home page buttons are almost ok. The refresh button doesnt work.
The code is below:
<a href="javascript:;" onClick="parent.document.getElement...
Hi,
I am trying to build a php/mysql website. But in the past, i didn't like the way php handled insert, update, delete, showing of entries. Ever since I have seen AJAX implemented beautifully on so many sites, i want to be able to do the same?
I am familiar with how to use PHP to accomplish:
DB Insert, Edit, Delete, and show. But ...
All the examples of jQuery.append() seem to take an html string and append it to a container. I have a slightly different use case. My server returns me an XML that contains HTML text to be displayed, something like:
<event source="foo">
<contents>
<h1>This is an event</h1>
This is the body of the event
</content...
I know we can attach a handler to the form onsubmit... But how can we add a handler to the form reset event? (usually when clicking on <input type="reset">)
Or... Maybe there is no such event... So the question becomes on how to work-around that?
(right now, I want to run a handler after the reset event; but someday I might need to run...
Hi Guys!
I want to set the value of stat from if else block but when I set it and alert it then it says to me "undefined". How can I set the value of stat. Here is my code.
deleteComment = function(postId){
var stat = "Don't Know";
FB.api(postId, 'delete', function(response) {
if (!response || response.error) {
stat = "Er...
Can someone point out the differences in implementation of ECMAScript 3rd edition in today's browsers? (Chrome, Safari, IE8, FF)
Are we safe when using ECMAScript 3 standards (and not the extensions that FF and IE have to JScript and JavaScript)?
...
Hi folks, I would like to get a deeper understanding of the nuances of javascript.
Take the function below:
str.replace(/(\b[^:]+):'([^']+)'/g, function ($0, param, value) {
ret[param] = value;
});
Why is there a need for /g?
What
exactly gets passed into the
function?
Where do these values come
from?
Thanks!
...
Sorry for a long question but here goes. I am trying to modify the drag shapes around demo here:
http://raphaeljs.com/graffle.html
The demo works fine. What I want to do is put words inside the shapes and move the shape and text around as a composite single object.
Here is the code for creating the objects:
window.onload = function...
This is related to an earlier question. I try to append HTML DOM returned in an AJAX response to an existing DIV. I see all the text, but it seems all markup such as bold, italic, etc is lost.
My AJAX (XML) data is like so:
<event source="foo">
<contents>
<h1>This is an event</h1>
This is the body of the event
<...
I'm writing a quite complex JavaScript application that has an MVC architecture that I'm implementing using Prototype's Class support and the Module pattern. The application uses AJAX and the Observer pattern. I create my controller instance when the DOM has loaded, pass it a view and some models created from JSON data and away it goes. ...
Hi,
I am handling a hyperlink's click event with a JavaScript function. I want to retrieve data from the hyperlink.
The page looks like this:
<div class="div1">
<div title="Title 1" class="div2">
<p class="p1"><a class="linkJs">The link in question</a></p>
</div>
</div>
<div class="div1">
<div title="Title 2" class="di...
I have a variable to the button below that I would like to replace:
<script type="text/javascript">
var btn = window.document.getElementById('btn_fb_1');
</script>
<button id="btn_fb_1" type="button">Log into Somewhere<br />(Joe Doe)</button>
Using the "btn" variable above, how to I replace the entire element with just text like thi...
Hi all,
Could any one explain me the difference between IE and DOM Standard event model in simple terms ?
Thanks.
...
post.php?replyto=username&othervariable=value
For example, if I click a link with this url, then I want to take the replyto=username value and insert the value in a textbox using jquery.
function insertParamIntoField(url, param, field) {
var anchor = document.createElement('a'), query;
anchor.value = url;
query =...