Fetching A GET URL

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


ADVERTISEMENT

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 View Related

Fetching Data From Other Web Pages

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

Fetching JSON Data To Server?

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

JQuery :: Fetching Data Of Selected Item?

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

JQuery :: Fetching Values From OnSuccess Function?

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

JQuery :: Fetching Data From Callback With $.ajax?

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

JQuery :: Loading Image While Fetching Data?

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

JQuery :: Fetching Data As The Option Is Selected?

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

Fetching Random Lines From Different Text Files

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

Fetching The Background-color From My .alt1 Css Class

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

Stops Working When Fetching Data From MySQL?

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

Fetching ID From Content To Determine Correct Link When Button Pressed?

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

JQuery :: Fetching Data From Another File And Use It For Changing The "img Src"?

Nov 10, 2011

I already know that i can change the src of an image-tag with jquery / javascript.BUT my problem is, that I try to load the new src-information from a dynamic html-sheet.So every 1 second the image src should be refreshed.

Some of my code:

<script src="jquery.js"></script>
<script>
var auto_refresh = setInterval(

[code]....

You can see in line 17 that it is no problem to show the fetched data from the other html-file in a div every 1 second.But I would like to change a picture dynamically.That means in detail:in the other html file stands either the value "0" or the value "1".This value should be fetched every 1 second (like the div-refresh) from the file.Then the value should be used as new src-name for the refreshing image, e.g.:fetched value = "1" => img src = "1.jpg" => [user can see a green light]fetched value = "0" => img src = "0.jpg" => [user can see a red light]How can I achieve this?

- How can I change the src name

- How can I refresh the image every 1 second with the new src name?

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved