jquery

Text color with fading over time effect

淺唱寂寞╮ 提交于 2021-02-08 08:48:09
问题 Is there any way i can do fading/decay color effect on html text by javascript or css? right now i read from database and append the text to a div, the text initially would be blue color and it will decay to black color over certain amount of time (like 5 secs). right now i just appending text to div with $('#txtBox1').append("#"+ data.message[i]+ "</br>"); 回答1: Can be easily done with CSS animations. Here's an example. jsFiddle Demo .fading { -webkit-animation-duration: 1s; -webkit-animation

Pulling records from database to javascript by Symfony2 controller

假装没事ソ 提交于 2021-02-08 08:43:20
问题 Im trying to fetch categories list from my database and put it in my javascript code so i can use it later. But I've encountered problems with this task - after returning this list to javascript - they are empty. Here is my symfony2 controller action code: public function fetchCategoriesAction(){ $categories = $this->getDoctrine()->getRepository('MyDataBundle:Category')->findAll(); $return=array("responseCode"=>200, "categories"=>$categories); $return=json_encode($return);//jscon encode the

Using JQuery Variable within Razor

一曲冷凌霜 提交于 2021-02-08 08:43:18
问题 How do you make use of a jquery variable within Url.Action within jquery? var id = "10"; window.location.href = '@Url.Action("MyAction", "MyController", new { id })'; Thanks 回答1: try, replace function by placing a token: var id = "10"; var actionUrl = "@Url.Action("MyAction","MyController", new { Id= "TabId" })"; window.location.href = actionUrl.replace("TabId", id); 回答2: If I understand you question correctly.. To achieve this I would make an Ajax call with your jQuery to a Razor page

PHP file upload inside modal window

佐手、 提交于 2021-02-08 08:41:46
问题 I have been searching the Internet for days with no luck. I need a modal window to upload a file and pass additional values to the script. The modal window needs to open when the user clicks on "This is Question #". Below is my current script. Any help or direction would be greatly appreciated. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <style> ul { list-style: none; margin: 0; padding: 0; } li { /*background-image: url(/images/page.png);*/

PHP file upload inside modal window

久未见 提交于 2021-02-08 08:41:01
问题 I have been searching the Internet for days with no luck. I need a modal window to upload a file and pass additional values to the script. The modal window needs to open when the user clicks on "This is Question #". Below is my current script. Any help or direction would be greatly appreciated. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <style> ul { list-style: none; margin: 0; padding: 0; } li { /*background-image: url(/images/page.png);*/

Branching logic quiz — where am I going wrong? [JavaScript]

≯℡__Kan透↙ 提交于 2021-02-08 08:27:22
问题 I am trying to develop logic for a "simple" jQuery quiz [Fiddle here]. The problem is, the question path is somewhat dynamic, and produces a tree structure. For example, the first question is about pets: dog, cat, or bird? If you choose dog, it asks what breed dog. If you choose cats, it asks what breed cat. Etc. Then it delves deeper ("What color dog of this particular breed?") The problem I am having is getting to that third set of questions. I can't get the color question to work for any

How do I pass data between 2 html pages using a button

爱⌒轻易说出口 提交于 2021-02-08 08:20:50
问题 I am trying to change the class of a button on one html page by clicking the button on another html page. I am a beginner/medium-level programmer This is the page where I'm supposed to click the button(html and js respectively): output.html <button class="waves-effect waves-light btn" id = "wutwut" onclick="testJS()">What Now?</button> $("#wutwut").click(function() { console.log("let's go"); var tutorial= $("#replace").html console.log(tutorial); $(function testJS(){ var b = document

How do I return the response from an asynchronous call?

非 Y 不嫁゛ 提交于 2021-02-08 08:20:27
问题 I have a function foo which makes an asynchronous request. How can I return the response/result from foo ? I tried returning the value from the callback, as well as assigning the result to a local variable inside the function and returning that one, but none of those ways actually return the response (they all return undefined or whatever the initial value of the variable result is). Example using jQuery's ajax function: function foo() { var result; $.ajax({ url: '...', success: function

Auto save form field inputs using jquery and ajax

杀马特。学长 韩版系。学妹 提交于 2021-02-08 08:18:22
问题 I have a form with different input fields.So for very minute , the data entered by the user needs to be automatically stored in the database. Once the request is submitted , it will be directed to the struts file where the database interactions will be carried out . What i have tried, I had set the timeout function to run every time the page is loaded var timer; $(document).ready(function() { timer = setTimeout("autosave()", 60000); }); And in the autosave function , i am trying to post the

How do I return the response from an asynchronous call?

家住魔仙堡 提交于 2021-02-08 08:18:17
问题 I have a function foo which makes an asynchronous request. How can I return the response/result from foo ? I tried returning the value from the callback, as well as assigning the result to a local variable inside the function and returning that one, but none of those ways actually return the response (they all return undefined or whatever the initial value of the variable result is). Example using jQuery's ajax function: function foo() { var result; $.ajax({ url: '...', success: function