ajax

How do I make Ajax calls at intervals without overlap?

I'm looking to setup a web page that samples data via AJAX calls from an embedded web-server. How would I set up the code so that one request doesn't overlap another? I should mention I have very little JavaScript experience and also a compelling reason not to use external libraries of any size bigger than maybe 10 or so kilobytes. ...

Submit Not Triggering Appropriate Accept Headers Using form_remote_tag

The form_remote_tag seems to generate the correct html, but format.html is rendered instead of format.js. The two most common answers to format.html being rendered instead of format.js are renaming the file *.rjs to *.js.rjs and making sure the the javascript files are actually loaded. Both of these have been done. Let me know if ther...

Upload and Crop image

Hi ... Im looking for upload and crop image in PHP. The scenario is: user choose image and upload to server after uploaded, the website display the uploaded image. user crop the image And upload the cropped image to the server. can you help me to implement this ? ...

Jquery: Appending data to a div AFTER ajax load operation

Hi I have a setup much like this: $('.container a').click(function(event) { event.preventDefault(); $('#contents').remove(); $(this).parent().append("<div id=\"contents\"></div>"); $('#contents').html('<img src="/images/loading.gif" />') .load("stuff.html") .append("<div id=\"closebut...

populating select box from controller function in Rails

I have a Rails web application with a select box: <%= select_tag :foo %> I'm looking to write a function in the controller which would populate this select box with some values. What code would I need to write in order to do that? The function is being invoked using observe_field: <%= observe_field :foo, :url => { :action => :popula...

XMLHTTP.open Not working in secong Call in IE6 and Running Properly in firefox

HI i have flowing code that runs as expected in Firefox and in IE6 it runs proper at first time and when the second call made it makes problem and returns old value function loadCartItems() { var xmlhttp23; if(xmlhttp23!= 'undefined') { xmlhttp23=getXmlHttpObject(); } xmlhttp23.onreadystatechange=function() { if(xmlhttp23.readyState...

rails linkto_remote

i want to implement a digg-like vote up/down method in my rails application using ajax. and i found that link_to_remote can do just that. but i want to check whether there's already a vote by the current user so that no user can vote up twice or more. how can i do that - how can i return values based on some condition so that an forbidde...

Adding event handler to iframe to invoke on keyup

On the webpage I have iframe, in which I display some content. I want to run a function if any key is pressed inside iframe (iframe is editable). I can do it using ajax (with scriptmanager on page): Sys.UI.DomEvent.addHandler(document.getElementById('iframe1').contentWindow.document, 'keyup', iframeKeyHandler); But I want to do it wi...

ajax request to different host

i have the following javascript in my webpage: var xhr = new XMLHttpRequest(); xhr.open('GET', 'http://www.google.com', true); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { alert('resp received, status:' + xhr.status + ', responseText: ' + xhr.responseText); } ...

How to load an image asyncronously with jQuery and how to know that the image loading is complete?

Well, the question is in the title. ...

adding values to a select box from a controller function (Ruby on Rails)

I have a Rails web application with a select box: <%= select_tag :foo %> I'm looking to write a function in the controller which would populate this select box with some values. What code would I need to write in order to do that? It's fine if the values are hard coded into the function. def populate # what goes here? end ...

php, jquery, flash & .click function in Firefox 3 - stumper

Hi all, I have a page that is using PHP to build itself and then uses Jquery to embed some SWF's into the page with different Flashvars based off the DB connection in the PHP section of code. I then have a jQuery .click(function(){ that fires a simple alert at the moment to test for functionality - this works as expected in Safari, but ...

Retrieve Database Value Without Page Load AJAX/PHP/Facebook Style

Hi all, I am wondering if anyone could show, or explain with examples, how facebook checks its database for new messages? It seems to do it periodically, without loading the page. What would be the best way to achieve this in a PHP/MySQL/Jquery script? Any help is always appreciated! Cheers, Lea ...

How to update a web page without reloading the web page using AJAX?

I'm trying to update info that a users entered in to a mysql database using php without reloading the web page how can I do this an example or tutorials will be nice. If there is a tutorial on how to do this can you please share with me the link or links to the tutorial(s). ...

[jQuery] $.ajax doesn't seem to be working

I'm working on a jQuery-powered registration form, and I'm checking all the input with jQuery, and the only thing left is to see if a user is choosing an already-registered name. Here's my Ajax request: $.ajax({ type: "POST", url: "check_user.php", data: "username="+username, success: function(){ errors.push('Your userna...

How to check a php response for string with jQuery

I have an ajax query sending to a php script and putting the response into a div. The code is as follows: $.ajax({ type: "POST", url: "core/process.php", data: data, success: function(response){ $("#form").fadeOut('slow'); alert("DO NOT LEAVE THIS PAGE UNTIL COMPLETE"); $("#response").html("DO NOT LEAVE THIS PAGE UNTIL COMPLETE...

How to manage an AJAX based 'like/dislike' feature?

I'd like to add a like/dislike-upvote/downovote-type feature to each one of the posts in the forum script I'm writing (much like the one here in SO). I'm having two difficulties trying to figure out how it can be done: 1) I can't figure out a db schema that'd do it efficiently. I could use a separate \likeordislike\ table to make a rela...

MVC architecture for front-end

Hi! I am writing application in PHP (+ MySQL database), but it gonna be mainly AJAX aplication. So, I am wondering, how to create frontend? Frontend also in MVC? Is it possible? ...

POST method, Ajax and Security?

I use Ajax (jQuery) and the POST method to update data in the database. I do the following: Get data from the form: user_id, entry_id, content,... Send them to a URL which will process the data. If the data is valid, we will record them in our database. I do not know how to verify that the user sends data from my website and not from...

Website scraping using jquery and ajax

Hello, I want to be able to manipulate the html of a given url. Something like html scraping. I know this can be done using curl or some scraping library.But i would like to know if it is possible to use jquery to make a get request to the url using ajax and retrieve the html of the url, and run jquery code on the html returned ? Thank...