Using YJS to synchronize data. But YJS does not work - javascript

I open two webpage. One is to delete and the other is to update. Does anyone know why?
I have tried many work. I don't konw why the delete action is invoked

Related

can't properly implement a MODAL (beginner)

Ive been stuck on this for a while now.
I have an API of a LIST that I want to display, each one of the objects on the list needs to be cliackable and a MODAL should appear with the LIST OBJECTS info ''pokemon height'', 'pokemon name'' and ''pokemon type''. The MODAL should also be CLOSED when clicking ESC or outside of the MODAL.
The thing is, I believe I added all the codes correctly but everytime I find an error, or the list simply disappears. I fix an error and another one appears, when there is no errors it simply just doesn't work. I am sorry if that is a rather simple thing to do but I am brand-new to programming and I am trying to learn.
It just seems that everytime I ''correct'' something, I get further away from the correct way of doing it. PLEASE if somebody could take a look in what I've done and give me some tips or point what should be done here. THANKS
HERE IS THE LINK TO MY "PROJECT":
added functions to loadDetails, loadList, addListItem (it worked)
then by adding the MODAl, CLOSE MODAL, HIDE MODAL, it just doesnt answer accordingly

One Modal, Ajax, and constantly updating data

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

How to create a page location in browser using javascript/jQuery?

I have a setup where I display a list of buttons and clicking on the buttons triggers a function that contacts a firebase database and gets the contents of a 'slide' that is to be shown to the user. The function then clears the content of the page and then creates elements from the data acquired from the database.
Now obviously, when I press back browser button once I've replaced the content, it won't take me back to the previous content. But I believe that my user's experience will be much better if it actually took them back to the list of buttons. I have two faint ideas on how to go about solving this problem but I'm lacking in specific details of how I can go about it.
Possible Solution 1:
Some way to dynamically create a new page using javascript and then serve it to the user.
Possible Solution 2:
Some way to simulate that the page has changed location. Maybe using anchoring links.
Let me know if you have any other solutions in mind or if you know how I should go about implementing these. Your help will be much appreciated. :D

How to programmatically expand fuelux treeview folders using jQuery?

I've been stuck in this problem. I am using fuelux treeview to display a list of categories and folders. What I want is to display the expanded treeview on page load. I can't seem to achieve this. I have found out that the tree folder must be clicked before the folder items are populated. So i tried to use
$('.tree-folder').trigger('click');
to trigger a click so that it may expand automatically. But this doesn't seem to work. I've tried
$('.tree-folder').click();
but it wont work too.
So how do you automatically trigger a click or just how do you automatically expand the fuelux treeview? Any ideas? Thanks in advance.
You'll want to makes sure you are triggering the click event on the correct element.
https://github.com/ExactTarget/fuelux/blob/3.2.1/js/tree.js#L35-L42
For Fuel UX 3.2.1 (current as of answer) run the following in the console on http://getfuelux.com/javascript.html#tree-usage for an example.
$('#treeIllustration .tree-branch-name').trigger('click')
This triggers the openFolder method which you could call directly.
https://github.com/ExactTarget/fuelux/blob/3.2.1/js/tree.js#L198
At this point after loaded.fu.tree triggers a method could be created/called to climb the tree recursively and call openFolder
This would be a nice enhancement. Please submit an issue so that it can be prioritized. If you come up with a good solution feel free to submit a pull request.
https://github.com/ExactTarget/fuelux/issues/new

Loading Specific Content from one page into another Page using Ajax

I'm new to Ajax and was told need to use it for what I'm trying to accomplish here.
Here is the website... http://modocom.ca/gillons
If you scroll down up will see a section called Find an Office with drop down menu in it. What I need is for when someone click on for example Emo in the dropdown menu the location info from.... http://modocom.ca/gillons/emo goes under the dropdown and so on for each location in the dropdown and also when your on the Emo page for example you click on the dropdown menu and can choose different location and get new info as well for selected location.
Hope that makes sense and hopefully someone could give me a hand.
Thanks,
Mike
OK, I'm not going to write code as it looks as though you haven't actually tried anything yourself yet.
However, the sequence of events, one version of them anyway, might look like this.
Using jQuery, put a change event on your dropdown.
When the event triggers, and this depends on your backend as you have not spcified APS.Net, MNV, Java etc, you need to post back to a code file of some sort and pass in the value within the dropdown.
From there, in your c#, java, pythod, whatever, code, take that value, generate some HTML and return that HTML to the client.
At the client, you accept the HTML and fill say a DIV with the returned HTML.
If you are using MVC, you can return a PartialView which is a better design.

Categories