Skip to content

Tag: javascript

Send response to all clients except sender

To send something to all clients, you use: To receive from clients, you use: How can I combine the two so that when recieving a message on the server from a client, I send that message to all users except the one sending the message? Do I have to hack it around by sending the client-id with the message and

How does a JavaScript parser work?

I’m trying to understand how JS is actually parsed. But my searches either return some ones very vaguely documented project of a “parser/generator” (i don’t even know what that means), or how to parse JS using a JS Engine using the magical “parse” method. I don’t want…

Remove Object from Array using JavaScript

How can I remove an object from an array? I wish to remove the object that includes name Kristian from someArray. For example: I want to achieve: Answer You can use several methods to remove item(s) from an Array: If you want to remove element at position x, use: Or Reply to the comment of @chill182: you can …

Check if innerHTML is empty

I have a ajax call on my onkeyup event, that checks if the given email address is in the database or not. My problem is, that I can’t find a right solution to check if the ajax response is EMPTY and if yes I need to disable a button. This is the ajax.php output: This is the JavaScript for the

Ajax call Into MVC Controller- URL Issue

I’ve looked at the previously-posted jQuery/MVC questions and haven’t found a workable answer. I have the following JavaScript code: When calling the Url the post looks like: Why does it return it like this (the logic behind it) and what’s a solution? P.S.: Additional Information: %22 is the…

add .js file as source in html file from server

I have an HTML file on my server, and a Javascript file on the same server. I want it so that when I load the HTML file, it will the reference of .js file placed on the server. I tried this way: but it is not working. Can any one tell me how I can do this?! I attached the

JavaScript get word before cursor

Okay, I’ve been looking all over the web to find a solution but I couldn’t find one, is there a way to get the word before the caret position in an editable div so a bit like: This should return the word “some”… I don’t know if this is possible, I would be glad for any help…