javascript

/Tag: javascript

React Fundamentals

By |2018-07-03T11:17:43+00:00June 29th, 2018|Categories: Front-end Development, Programming, Web|Tags: , , |

The web has become the dominant programming model of our time, but building rich web applications can become extremely complicated and now a day the need to create reusable UI components is more needed  and React was built to solve one main problem: building large applications with data that changes over time and to simplify the process of building complex UIs. ReactJS Overview In this article React Fundamentals, you will learn foundational knowledge of React. First, you will learn how to structure an application out of components and how to build those components with React. Next, you will discover JSX syntax and [...]

Organize JavaScript and jQuery events – DOM-ready execution

By |2012-04-19T17:32:31+00:00April 19th, 2012|Categories: Programming|Tags: , |

In complex websites javascript and jquery events can conflict with each other, especially if you are using the same javascript files for different website pages. There are many techniques to solve this issue, and I found a good solution by following these articles: Automate firing of onload events Markup-based unobtrusive comprehensive DOM-ready execution Extending Paul Irish’s comprehensive DOM-ready execution But while using this technique I faced an issue, I wanted to call more than one init function on the same page load, for example if I have my page as sections: header, login popup, inner form, footer. And each section needs [...]

Avoid sending Ajax request parameters in query string style

By |2011-06-29T17:36:36+00:00June 29th, 2011|Categories: Technical|Tags: , , |

While reviewing some code, I found someone calling jQuery Ajax like this: $.ajax({       type: "POST",       url: "/AddPost",       data:  "postText="+ PostText ,       dataType: "json",       success: function (status) {        }}); //$.ajax({ And as you see in the previous code, it is sending the data using this line: data: "postText="+ PostText , This is like a query string style, this will work well but image the user inserted a special char in PostText, such as ?? you will get on the server un expected value “"jQuery15107041011152323335_1309357585354"” So never use this style while dealing with Ajax calls, you need to post it in JSON [...]