Fetching A Page In The Background
Feb 7, 2006
I'm sure there's some fancy Ajax way to do this, but I'm looking for
something simple. Is it possible to fetch a page from within a javascript
function? Basically what I want to do is allow the user to click a button to
add an item to a shopping cart *without* leaving the current page. Something
like this:
<a href="javascript:addToCart()">Click to add this thing to the cart</a>
<script>
function addToCart() {
String results =
fetchPage("http://mysite.com/addToCartPage.jsp?item-number=123");
alert(results); // shows a success or failure message
}
</script>
Unfortunately, I can't find any such fetchPage() function. Is there a
simple, cross-browser way to do the same thing?
View 1 Replies
ADVERTISEMENT
Oct 14, 2007
I have a style sheet with a certain element I'd like to obtain the background-color property because I've recently stopped using bgcolor="#xxxxxxx" and replaced it with class="alt1" or class="alt2" for my <tr>'s and <td's>.
The problem begins with the SWF flash object function I have (to prevent the double click for swf movies on the web page). One of the arguments allow me to set the background color but it only takes a hex color such as #333333 but since I've converted my bgcolor= to class= I can no longer access the required hex color to send to the flash object function.
I would like to now try to access the alt1 or alt2 property of my css sheet, which looks like this: Code:
View 1 Replies
View Related
Feb 8, 2005
in PHP you can make a statement to the likes of
if (issett($_GET)) {
do stuff
}
else {
do other stuff
}
I was wondering what the equivalent is to call a GET with javascript EXAMPLE
<a href="page=yourpage&action=edit">edit</a>
<a href="page=yourpage&action=add">Add</a>
consider those 2 URL's
the JS:
if (action=edit) {
do this;
}
else if (action = add){
do something else;
}
View 5 Replies
View Related
May 14, 2005
Is there any way I could fetch data from another web page?
Things like current weather, and rate of exchange?
I would search the data for example by
-loading a web page somehow (IFRAME?)
-going through all <td> tags in it and
-if the <td> had a spesific text, like "weather in Fooland" then
-I'd jump to the next <td> tag and take the text inside it, that hopefully had the data I was looking for.
I used an IFRAME to load a web page. It's id is called "myiframe"
var myIframe = document.getElementById("myiframe")
var iframeBody = myIframe.body;
var paragraphs = iframeBody.getElementsByTagName("p");
document.write(paragraphs.length); //this writes 0!
the page I loaded on the IFRAME has paragraph elements right on body. Why can't I find them?
I tried using node iterator (document.createNodeIterator() ? ) too, but that didn't work at all! I tried it without the IFRAME too. If you have any guesses what it might be, please tell me. Should it work in Mozilla? Should I create the node Iterator only after the page has finished loading?
View 1 Replies
View Related
Apr 18, 2011
I am having trouble sending JSON data to a server. Its definitely reaching the parser.php, but I am not what to create in PHP to fetch this data. Also I am not sure my Javascript is correct.
<SCRIPT>
var JSONObject = new Object;
JSONObject.description = "hello";
JSONstring = JSON.stringify(JSONObject);
runAjax(JSONstring);
[Code]...
View 5 Replies
View Related
Mar 24, 2010
I want that data against each option should be loaded as the option is selected in the combo box. As, while registering on yahoo, when we select a country all provinces of that country are loaded. (No need to click a submit button.)
View 1 Replies
View Related
Jul 26, 2010
I am usign $.post() method to post selected value in a drop down to server. On server-side I fetch resultset based on the selected value, and serialize the result set via the Response object which is fetched by the on Success function within $.post. How can set the textbox values conatined within that result set to those textboxes? Rather how can I fetch each of the values out from that response object in JQuery?
View 1 Replies
View Related
Jul 25, 2009
<span style="font-family: courier new,monospace;">Hello all,</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">I've recently started with jQuery because I wanted to use it for posting details from an login form to a PHP script which should return whether the user is authenticated ox not.</span><br style="font-family: courier new,monospace;"> <br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">For this I use $.ajax, because of it's flexibility and I prefer to use it in this implementation. Reading (jQuery docs and examples) and searching a lot did not solve me on one issue: fetching the data in the callback to the global scope.
</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">Here is the code:</span><br style="font-family: courier new,monospace;"><font style="font-family: courier new,monospace;" size="2"><script type="text/javascript">
[Code].....
how can I let the function that should check the message of the response know that 'msg' has been set?
View 2 Replies
View Related
Aug 11, 2010
Apologies if this is a fairly simple question! I'm fetching data (from a MySQL database), and would like to show an animated loading image while the data is being downloaded, and obviously then hide it when the data is fully downloaded. I've found plenty of tutorials describing how to achieve this is the other direction (i.e. when submitting a form) but I'm not sure how to adapt these to what I want.
View 2 Replies
View Related
Mar 24, 2010
I want that data against each option should be loaded as the option is selected in the combo box. As, while registering on yahoo, when we select a country all provinces of that country are loaded. (No need to click a submit button.)
View 3 Replies
View Related
Aug 1, 2011
I'm looking for a way to have a single, random line fetched from multiple text files, and then have that combination output somewhere, whether just to some field or another text file.
For example:
Text file A -
Text file B -
Text file C -
So it would go in, get a line from each, and display something like:
I know it's a weird-sounding example, but you get the point. The line choices don't have to be separated by hyphens, but they preferably would be separated by something, like a comma, semi-colon, slash, whatever.
I know this is pretty much a web coding forum, so that would be fine if I had to host it on my server or open it with a browser. But it would be optimal if this could be made into a standalone executable.
I'm basically looking for something like Random Line Picker [url], just with the added functionality I mentioned.
I'd be willing to make a little donation to someone if coding this would be a little difficult.
View 3 Replies
View Related
Aug 3, 2011
I have my doubts if this question belongs to the javascript side since it's all good until the data from MySQL comes in, but since the javascript is the one breaking I'll take my chances.
The external js (portada.js)
Code:
$(document).ready(function(){
var currentPosition = 0;
var currentPosition2 = 0;
var currentPosition3 = 0;
[Code]....
As you can see I have three divs with different slideshows (slideshow, slideshow2 and slideshow3), they have products that slide to the left. When I was testing to make sure it all looks good the sliding feature was working fine, but I lost this feature when the data was being retrieved from MySQL (at the moment on <div class="slide">).
View 3 Replies
View Related
Mar 24, 2011
i have a website with content on specific pages i need some sort of JS soloution which will fetch an ID/Keyword out of the page content so when a button is clicked it finds the ID/keyword and directs the user to a specific form/page.
View 1 Replies
View Related
Jul 20, 2005
Is it posssible to inherit the previous pages (parent pages)
background image? Is there a script out there I could look at?
View 4 Replies
View Related
Jul 16, 2010
how to dim/fade the entire page using JQuery? I would like a mouseover effect to activate the dimming effect.
View 1 Replies
View Related
Jul 16, 2010
When i'm click on the web page, the page turn off to balck color. is it possible?
View 4 Replies
View Related
Mar 19, 2010
I have a small script that changes the background color of my page from white to grey when the user clicks a button.at the moment it works fine accept for when the user tries to navigate to another page (on my website) after changing the background color.if a user changes the background color to grey and than tries to view another page, the background color becomes white again.is there any way to make the change only controlled by the button?my head code looks like this (at least the relevant parts):
View 8 Replies
View Related
Dec 27, 2010
I need to run a php script in the background after one of my pages loads (eventually it will be 2 or three background scripts depending on the user.) I am guessing I will need to use $.get for this but can not seem to figure out how to do it. Currently I have the following in my code:
$.get("ARS_newEmployeeMailer.php"
, {userid: "1004"
};
[Code].....
However, this php is not being called.
View 1 Replies
View Related
Feb 10, 2011
I am trying to make a way to toggle the background colour of a page.
I have managed to find this way, but instead of two seperate links I just want to have an icon which when clicked once changes the colour and changes the icon, then clicked again returns to the other colour and replaces the icon.
Here is my code so far:
View 3 Replies
View Related
Jan 27, 2011
I've tried the following:
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[[code]......
I've tested the if statement and the set background code, using a button. I'm guessing it fails since there is no background when the script runs.
View 2 Replies
View Related
Mar 29, 2011
I have developed a modal image box which is working as desired except for one thing. I can't get the background div to cover the entire window background when the backgroud extends beyond the visible window size(requiring vertical scrolling).The background will only fill to the size of the the visible window area. If I scroll the window while the modal box is showing the lower area is exposed. I have the background div height set to 100%. I have tried min-height: 100%. I have also just made the height a really big number which causes the page to expand too. I guess I am asking how this is done in the JQuery UI dialog which works just fine on the same page.
View 4 Replies
View Related
Jan 27, 2011
I have a client that wants a new background image every time page is reloaded. I thought I have to script and thought I had it working but when I applied it to all my pages from a template I made in dreamweaver it doesn't work. It only works on the template.
See code below.
<head>
<script type="text/javascript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_displayStatusMsg(msgStr) { //v1.0
status=msgStr;
document.MM_returnValue = true;
}
//-->
</script>
</head>
<body>
<script>
var randombgs=["../images/main_background.png", "../images/main_background2.png", "../images/main_background3.png", "../images/main_background4.png", "../images/main_background.png", "../images/main_background2.png", "../images/main_background3.png", "../images/main_background4.png"]
document.write('<body background="'+randombgs[Math.floor(Math.random()*randombgs.length)]+'" bgcolor="#FFFFFF">')
</script>
</body
View 1 Replies
View Related
Feb 17, 2009
I need to have a page wait till the entire thing is loaded before the user interacts with it. I would like for it to do a lightbox styled grey box over it or even something like plesk does where it fades out the background (same effect really) until the page has loaded
View 3 Replies
View Related
Feb 15, 2012
I have a drop down menu on my page, and I want to change the background color of the box from white to match the rest of the page, how do I do this.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
[code].....
View 8 Replies
View Related
Jan 25, 2007
I need create offline html page, graphic menu for autorun. How to resize a html page to perfectly fit a background image size? I need html page that need be resized to perfectly fit a background image size, also, this page need be centered on screen.
View 6 Replies
View Related
Jan 12, 2010
I have installed a flash mp3 player that streams music while browsing my website. Unfortunately there is a problem that any time you click a link to another page, everything reloads and the music restarts. Looking for advice on how to implement the music stream so it plays continuously and not affected by changing pages of the site. I would like to avoid any sort of frames implementation. Only other thing I can think of is some sort of AJAX implementation
View 1 Replies
View Related