Refresh page once via ajax

I have a php webpage that has a single input box. When ever an item is entered and the Submit button is pressed,
the entry is added to a database. Additionally, the database table contents are read and printed directly below the input box and the submit button on the same page, using AJAX.


I have decided to add additional functionality to the page. I want a delete button for each entry displayed in the table below. For any button that is pressed, I want to delete that entry from the database.

This I can achieve.

Here's the problem:

I want the database table contents that has been printed below to reflect this change. I can achieve the delete, but in order to show the change in content caused by the delete, the table below must either be replaced or updated via ajax.

How can I achieve this

I have been trying to follow these examples using jQuery and Mootools respectively, but I've been having no luck.

I don't want all the fancy looks, I just want the core functionality.

Posted On: Thursday 29th of November 2012 08:32:28 PM Total Views:  167
View Complete with Replies

Related Messages:

jquery mobile refresh help   (275 Views)
, I am having trouble with getting jquery mobile not cache pages on the device. Does anyone know of a way to do this, I am COMPLETELY lost.
Page refresh when MySQL db changes   (117 Views)
I have heard that AJAX is a way to get a page to refresh when a MySQL db has changed. Basically we have a log (that several users at a time could be looking at), when data is submitted it posts to the MySQL db. Instead of having the page auto-refresh every 2 minutes or so, it would be nice if it would just refresh when a change is detected in the db. This would also cut down on the chances that data is missed due to inopportune refreshing/submitting. Pretty much a novice so any help on where to start would be appreciated. DS, When an AJAX request is complete, the connection between the script and the server is closed. The communication dynamics is just like that between the browser and the server. Once the connection is closed, the server does not know who just asked for whatever resource, so it cannot notify any of its clients of new changes. You would need to do it as you are currently doing, polling/checking periodically for changes to the db. On another note, the funtionality that you are looking for I have seen it but with applets on the client side and Tomcat web server on the back end. Not sure if you want to pursue that, but that would be the way to go. Basically you would be creating a "Chat application" where the users only get to chat with your application (as opposed to other users). When the user chats, the server application receives the message and saves it to the db. As soon as the data is saved, the server sends a "chat message" to all the users. Instead of saying "You have new data. Refresh Now", the server would just "push" the updated info to the clients. The client application would "erase" the old data and update with the new data.
Iframe issue must refresh   (131 Views)
I have an issue with my iframe, that contains pages of my online shop. When using paypal, having added a product to the cart and on the paypal page, you click. continue shopping, you are returned to the shop but other 'add to cart buttons' are non functional unless the iframe is first refreshed. Can anyone please help Page containing iframe, please test
Dynamic iFrame height, not working in ie without refresh.   (355 Views)
When i try to dynamically change the height of an iframe in ie through a java-script to match its content (a html page containing a flash movie), it doesn't resize the iframe at first, but when i reload the same page into the iFrame it resizes as planned, how come Any ideas This script works well in firefox, safari and netscape, but i cant get it to work in ie(8, 7). And i get the same problems with every resizing script i've tried. This is the script i use: The iframes: IFRAME> I have a flash menu in the first iframe, the buttons on the menu uses getURL(siteToLoad, "contents") to load another html-page into the iframe "contents". Is it possible to make the iFrame refresh automatically though javascript so that i just refreshes the iframe once Everytime ive tried that it just ends up in a never ending refresh-loop... How can i make this work Is there any better script for resizing (and refreshing after resize) the iframe height so that it matches to its content Please, i've been stuck with this problem for some days now... // Max
Retain multiple checkbox selection upon refresh or?   (136 Views)
Can we retain multiple checkbox selection upon refresh or using pagination for few hundred records There is a page where user sees all the items which has search box on the field column to perform searches and select items using checkbox besides those items. While searching the items page result changes and previous selected value is lost. Also the selection is lost when I use the pagination link below the result. Any Solution
window refresh issue   (231 Views)
background: I have a computer with 2 monitors. One monitor opens a web page to an inventory manager(M1). The other monitor has a web page with a display of available inventory(M2). When I update something on M1 and the page reloads I want it to automatically refresh M2. Currently I just have a timer running on M2 that refreshes the page every 60 seconds. It would be better if it only refreshed when needed. The base code is all in PHP. The web page that opens for M2 I'm just using a target="inv". I've tried a bunch of variations of javascript but can't get M2 to refresh when M1 reloads. I was thinking the easier way to do this would be: 1. Check to see if the M2 window is open. I can open it with the same name every time. 2. If the M2 window is open make it redirect to show.php I just don't know javascript enough to do this.
No tab/page refresh when internet options internet?   (133 Views)
Hi Experts here, Pls help. first I set the following in IE6 :Under Tools/Internet Options... 1) Temporary Internet file [Settings...] 2) Check for newer versions of stored pages 3) "Never" option is selected Double click a category to change the current one; tab category stays the same.No tab/page refresh when internet options under temp internet settings are set to never retrieve new stored pages. please help me How to do that should work properly .
image change on refresh   (232 Views)
Hi , I have seen a lot of examples of what I am after online, however nothing is quite what I need. What I am attempting to do makes things a little more complex. Within a div, I have quite a few images displayed (I am only showing a couple). Now to try and explain the above. When my page is loaded, the first a displays 1.jpg and the second a displays 2.jpg. 1tab.jpg and 2tab.jpg are set to display:none. When the page is resized, css in my media query sets 1.jpg and 2.jpg to display none, and 1tab.jpg and 2tab.jpg to display block. So basically only 1 image is ever displayed within an a at any one time, the image depends on the size of the browser. Now for the fun part. What I am attempting to do is change the images with javascript everytime the page is refreshed. I wont bother about the tab images for now, I showed these to demonstrate what I am doing, incase it has a bearing on what I need to do. Ok, so now I display 1.jpg and 2.jpg. When the page is refreshed, I need it to display 2 new images 3.jpg and 4.jpg. When the page is refreshed again, it will go back to 1 and 2 and so forth. Is something like this possible As I say, I have seen some examples, but they all seem to display random images in one location. I know what images I want displayed, and I have several places I want to display them. Cheers
Javascript: Changing text color in span tags after refresh   (87 Views)
Hi: How can I change the text color in a span tag after a refresh This is what I have done so far: var colors = new Array(); colors[0]="red"; colors[1]="orange"; colors[2]="blue"; colors[3]="green"; colors[4]="purple"; colors[5]="pink"; colors[6]="brown"; var colors = Math.floor(Math.random()*7); I'm just stuck on what I should do next
Dropdown submit without refresh   (112 Views)
So my code is simple html, I need it to select value when submit and if value= that number, submits something like: "Your number is 1"(without refreshing the page).
Help, Table row/cell refresh image when clicked (referring?   (177 Views)
I've been reading and trying to figure out a way for half a day yesterday, and any solutions seems to fit to this. Overview: My solution is building up xml files from different folders on another server. After the xml is built up, I can run a "File Mapping" which will grab the appropriate information from the a specific xml selected with a dropdown and pass it to the asp:repeater. The binding is done on load, reading all the xml elements and passing it to a collection of object that will be bound to the repeater ( results.DataSource = listOfObjects; results.DataBind(); ) Now here is the problem. In each row of the table there is columns containing static informations and the last cell of the row is an img button that represent a gray checkmark and that on click should change to green. However, onclick now I only change the data to the xml, and on next "File map" it'll be there. I cannot simply refresh the page, because it takes a fairly long amount of time to refresh because most of the times there is over 350 records to load and above that, you cannot simply refresh page because the page is call through ajax and a refresh will bring you back to the default.aspx. I've already built a function to get the param back through jQuery, however I really have no clue how to bind it to the image. Current line with image: IsQAComplete being the bool used used for checkmark which is referring to the listObject.
AJAX page refresh help ?   (108 Views)
I want to make my current song playing update with AJAX on my page every time that the song name changes I can get the variable to post in the page but currently use a meta-refresh based on time of file or every 30 sdeconds ... what I would like to do is have ajax do this without a meta refresh can this be done Anyone I would be most greatful
Data persistence and refresh   (60 Views)
I have a piece of elearning where users move from screen to screen. The content itself is displayed within an IFRAME with the parent window containing the various navigation controls and javascript. I did it this way because there's a ...
refresh page after ajax request and after client-side removal of DOM element - JavaScript Help   (191 Views)
How can i reload the page in this jquery function $(document).ready(function(){ $('table td a.delete3').click(function(){ var del_id = $(this).parent().attr('id'); var info = 'del_option_id=' + del_id; if(confirm("Zeker dat je deze optie met id " + del_id + " wilt verwijderen")){ $.ajax({ type: "POST", url: "deleteActies.php", data: info, success: function(){ } }); $(this).parent().remove(); } return false; }); });First the ajax call should be finished, then the element (an option belonging to a question) should be removed --> $(this).parent().remove() and then the page should be reloaded.
Save data without refreshing form - JavaScript Help   (77 Views)
Plz helpI have a registration form. I need if someone fill something wrong, the form stop sending data without refreshing or losing data
Autofill a textbox without refreshing the page - JavaScript Help   (81 Views)
Hi.I would like to automatically fill in the textbox labeled "Amount 2" after choosing the value of Amount without refreshing the page. I guess it requires javascript or AJAX but i don't know how to do it. Any help please$options_amount = array("0","1","2","3","4","5","6","7","8","9","10+"); $metabox = array(); $metabox[] = array( "name" => "amount", "label" => "Amount", "desc" => "Choose the amount.", "std" => "0", "type" => "select", "options" => $options_amount); $metabox[] = array( "name" => "amount2", "label" => "Amount 2", "desc" => "No need to enter it.", "std" => "", "type" => "text");
Onchange="form1.submit(); help keeps refreshing and losing data - JavaScript Help   (108 Views)
I have got a registration form requiring usual, name, address, username, email etcLater on toward the end of the form it asks for country and then state. The country and states are stored in a database and the form queries the database for the states stored according to country. Trouble is that everytime I click on a country it refreshes the whole page and loses all the data that had been types in thus far...not only that but it doesn't select the state, just defaults back to please select a country.The coding relevant to the form reads below. Country :   State :   I am guessingt hat it has got to do with the submit perhaps being similar to the submit button that I use to post the form with  However, this is really frustrating and holding me back. ANy help on this would be greatly appreciated. Many
jQuery to refresh PHP variable - JavaScript Help   (420 Views)
I have a PHP random number generator, however this requires page loads to generate another number.If I put the PHP code in a script file, how can I get a button to refresh/update it with an jQuery/Ajax http requestPHP code:
refresh markers google maps   (127 Views)
Hi! I am new here. Sorry for my english, I am spanish and I am not so fluent as I should. I am developing a webpage and I want to keep updated some markers in google maps. I took these markers from a DB. I have a php file which creates a json and I take markers from it. For the moment I am able to show markers but I can't update them. I have tried lot of things and I don't know what more I can do. My php file is: json.php: $row['lat'], "lng" => $row['lng']); $x++; } //echo json_encode($data); //echo 'data='.json_encode($data),';'; echo '{"markers":'.json_encode($data),'}'; > And my webpage, for the moment, is: Google Maps var map; var markersArray = []; function initialize() { if (GBrowserIsCompatible()) { map = new google.maps.Map(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(43.4669443349282,-3.862788677215576),9); } GDownloadUrl("json.php", process_it); } function createMarker(point, map) { var marker = new GMarker(point, map); return marker; } // ================================================================ // === Define the function thats going to process the JSON file === function process_it(doc) { // === Parse the JSON document === var jsonData = eval('(' + doc + ')'); resetMarkers(markersArray); for (var i=0; i
how the chat screen is refresh to bottom after the send button submit   (121 Views)