[JS Help]refresh a div |
[eluser]minoh[/eluser]
Hi guys, I have a popup wich stores data on session, i want to on submitting the form, refresh the table placed in a div on the parent page. i just need to refresh the div. thanks.
[eluser]pistolPete[/eluser]
I'd use jquery. Load jquery in both the popup and the parent window. Then you need to catch the submit event in the popup window: Code: $("#popup_form").submit(function () {
[eluser]minoh[/eluser]
Nothing change, still have no refresh, this is what i wrote: Code: //loading jquery in both popup and parent page
[eluser]minoh[/eluser]
[quote author="pistolPete" date="1256307232"]Did you check (using Firebug) if there any JS errors?[/quote] I get a : Failed to load source for : http://localhost/.../add do you have an idea, what can be the problem ?
[eluser]minoh[/eluser]
[quote author="minoh" date="1256308025"][quote author="pistolPete" date="1256307232"]Did you check (using Firebug) if there any JS errors?[/quote] I get a : Failed to load source for : http://localhost/.../add do you have an idea, what can be the problem ?[/quote] i fixed the error, it was because i include prototype.js which i dont use. now i have no error but still have no refresh of the parent page div.
[eluser]minoh[/eluser]
i modify the script to : Code: if(document.popupFournituresEdit.submit) the refresh action works, but the entire page is duplicated on the Div. any help ?
[eluser]pistolPete[/eluser]
The function which you load using $('#fournituresDiv').load(...) should just return the contents of the div, not the whole page!
[eluser]minoh[/eluser]
[quote author="pistolPete" date="1256332023"]The function which you load using $('#fournituresDiv').load(...) should just return the contents of the div, not the whole page![/quote] but if the function should just return the contents of the div, that means that i have to create function for every table display ? and also where the parent 'url' should be entered if the load will contains the 'div contents method' ?
[eluser]pistolPete[/eluser]
[quote author="minoh" date="1256336850"]but if the function should just return the contents of the div, that means that i have to create function for every table display ?[/quote] How much do the tables differ? Maybe you could use one function for all, but that depends on your content. Please post some example data and use cases. [quote author="minoh" date="1256336850"]and also where the parent 'url' should be entered if the load will contains the 'div contents method' ?[/quote] I don't understand your problem there, could you explain it again? |
Welcome Guest, Not a member yet? Register Sign In |