i have a grid view and a file upload button on a page. I have users load their data to my site and i parse their files and load onto the gridview. Then using ajax i update the javascript/jquery I allow users to edit their data right on the gridview. My problem is somehting that should be simple to fix but yet im stumped. Once the user is ready to submit the gridview data for good i have an AJAX call to a webservice that i send all the information on the grid. Then i would like to clear the grid and basically start with a clean page again. However i cant seem to clear the grid view. The data just keeps refreshing in the control with the original data. I realize that it has to do with the fact that is bound on the server but i cant unbinded!. i have tried.
window.location.reload()
but all this does its get me a crappy message from firefox telling me that the page is going to refresh.
I saw this on this site from various people
Response.Redirect(Request.RawUrl);
however i don't know how i can trigger that from an Ajax call?. Can i? I'm doing everything through Ajax partly because is where im most comfortable, but i would hate to have to put another button on the page and make the user have to click that button to restart it seems silly. I would like to do a full page refresh on my command. Is there anyway to do this via AJAX? putting a server button does not seem feasible to me due to the fact that once i load data in grid view i use jquery data table and jeditable and work pretty much on the client.
I'm open to suggestion, ideas, tips, anything at this point. So frustrated with what should be a simple task.
Thanks in advance
Miguel
To force a full page refresh without postback you can set the window.location.href value to the current window.location.href
e.g.
Imagine our current scope is the success callback of your grid data ajax submission function, so when the page reloads all new data will be fetched.
//reload the page now that data has been updated.
window.location.href = window.location.href;
If you must use server controls, you can wrap it in an UpdatePanel. This will make it ajax-enabled, but is pretty brute force.
There are nice libraries from companies like Telerik that have ajax-enabled controls. These cost some dough, but if you are doing a lot this it may be worth it.
Another option that does not support server templates/databinding is to use a jQuery based grid like jqQrid.
Related
I have reached a point in my project where I cannot figure out how to use Ajax to keep going. I am new to using it, but I'd like to think that I have a basic understanding of how it works.
I run a site where I take form data and post it into a database, then send it to a webpage where it displays in bubbles. Users can then click these bubbles and pop open a modal which has more detailed information than what is presented in the small bubbles initially displayed.
I've hit a wall where I don't know how to open a modal and have it live update with new information without closing, no matter what the bubble they click is (which can have different types based on different form information sent).
And to be clear, by bubble I just mean a compact div that when clicked opens the modal.
I've looked everywhere for solutions to this, trying my best to apply knowledge from other projects to what I'm trying to accomplish with to no avail. Suggestions are appreciated!
I'd suggest you to look at the load method this should be enough for what you're trying to do.
If you want a live update of your modal you have two ways to go about this:
Implement polling in AJAX. Send an AJAX request every X seconds to the server and have it update the <div>'s in your modal.
Use WebSockets. This is far more complex, and solution 1. is probably good enough.
This Stack Overflow post should help get you started: jQuery, simple polling example
Hi i want to make an effect similar to what this site does http://www.hffm.co.uk/
When you change the page the url up top changes but the content in the sidebar and header stays the same. - i am also curious if this affects SEO.
They stay the same - and do not reload with the page - i figure it has to be some ajax thing? Curious what a system like this is called.
The point is in their case they dont want to interrupt the radio on a link change.
To update the specific part of the page it can be achieved through Ajax and JQuery. Basically both of the those works on the client side which means that website doesn't refresh. You can always make a Ajax request to the server which can return the content in a Json format and that content can be reflected on the page using Jquery.
This is only just a overview of how ajax/Jquery works. But you need to be more specific in what you are trying to achieve and what you have done so far.
I am working on a radio website, with a player, and a bunch of banners where you can click on to play a radio.
The ideal behavior in my opinion would be that if i click on the button to play a radio, it'll jump to the player. But now its refreshing the page, and jumping to the top of the page. which is a bit annoying.
I got an form with multiple buttons, those buttons contain the ID of the radio from the database.
Then i got my player, without the form being posted, printing a default player, on submit of the form, it'll load all the information needed from the database with the ID that's being posted to the player.
Now my question is, how to stop the form from refreshing and jumping back to the top of the page, while it does post to the player.
if you guys need any code, i am wiling to post it here, but since it a shitload of code on my index.php i need a site where i can put this on.
You're going to want to use Javascript (and more specifically: AJAX) for this. It may seem daunting, but especially when used in combination with jQuery, it's quite doable.
The idea is basically to send requests to a different page on the background, without reloading the page, and to use Javascript to update the current page with the newly received information. There are plenty resources on the subject that do a much better job of explaining the details than I could here, but I hope this gives you sufficient keywords :)
Web based radio players are usually SPAs (Single Page Applications) because reloading the page interrupts the radio player. That means the page loads only once, and all other content is loaded via AJAX requests that do not require reloading the whole page.
There are several libraries that you can use to achieve this architecture (like Angular.JS for example). Building such an architecture from the ground up with plain JS can easily get too difficult to maintain.
Here you can use ajax and then call your radio player which is not in form...
Find below example.
$("button").click(function(){
$.ajax({url: "demo_test.txt",
success: function(result){
$("#div1").html(result);
}
});
});
Hope this wil help.
I have a question about automatically refreshing a SharePoint form library any time an item is added to it. We have a business team within our company where any individual on the team can fill out a particular InfoPath form. Once that form is filled out and submitted, it is saved to the aforementioned SharePoint form library.
When any user submits a form like this, the other users like to know that it has happened and they almost always have their browsers open and pointed to this particular SharePoint form library. These form submissions and the data they contain are somewhat time-critical, so it's an important way for everyone on the team to be up-to-date about the submitted information.
Does anyone know if such a workflow is possible in InfoPath? I've Googled this issue already and I've found a lot of helpful advice about redirecting to the same page using the SPUtility class's functionality (which does seem to work), but I want to refresh/redirect the entire page, not just the pop-up window for which the SPUtility class is apparently responsible. I've also seen some results suggest using a Content Editor web part containing some JavaScript for refreshing the page and then accessing that Content Editor via a workflow or event receiver. Does anyone have any experience solving an issue like this or have some ideas? I'm not looking for anyone to write the solution for me - I just need a push in the right direction from someone that's more experienced with SharePoint.
Thanks!
I would suggest a bit of JavaScript that periodically redirects the page to itself. If you wanted to get flashy, you could use the Client Object Model to query the list for the last modified date of the last modified item. If that changes, refresh, or you could use the Notifications API to show a nice 'Notification', perhaps with a refresh button that reloads the page?
I have a query and don't know where to start - I have a image select input field on a form thats populated by an jquery ajax autocomplete. What I would like to do is the following:-
If a user wants to choose an alternative image that's not currently in the dB pop up a modal/lightbox form which contains the upload/editing form.
Once posted I want to pass this data back to the original form field and refresh the data for the autocomplete.
I already have the upload and editing forms working as standalone pages I just want to incorporate the output back into the original form.
Is it possible?
Can anyone suggest modal/lighbox script that can do this?
What data are you trying to retrieve in the parent window? Assuming your using an iframe in your lightbox? If you aren't then you should just be able to set variables and call functions from your upload script output as if it were the same page.
If you are...
I don't believe there are any lightbox/modal solutions that support this, I normally incorporate a script like below in my upload script so you can monitor the success/failure of the uploaded file and the data.
(function () {
parent.myClass.imageLocation = $output_your_image_location here;
return;
)();
You can obviously edit this to handle different situations but I always use the parent keyword as I have a similar way of handling uploads in some software I've built recently.