Skip to content

Instantly share code, notes, and snippets.

View sohel-rana's full-sized avatar

Md Sohel Rana sohel-rana

View GitHub Profile
@sohel-rana
sohel-rana / index.html
Created October 21, 2012 06:08
Sample index.html file for custom build of ExtJS components
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="ext/ux/css/CheckHeader.css" />
<script type="text/javascript" src="ext/ext.js"></script>
var userEmail=$('#emailinput').val();
$.ajax({
url: 'ajax/sendEmail.php',
data: { email: userEmail },
success: function(data) {
alert('Email has been sent successfully!!!');
}
});
@sohel-rana
sohel-rana / encodeEmail.js
Created November 28, 2012 20:01
Encoding the input element so that it is sent properly to the server
var userEmail=encodeURIComponent($('#emailinput').val());
$.ajax({
url: 'ajax/sendEmail.php',
data: { email: userEmail },
success: function(data) {
alert('Email has been sent successfully!!!');
}
});
var list=Array();
list.push({id:1,name:'sohel'});
list.push({id:2,name:'kahled'});
list.push({id:3,name:'Rayan'});
list.push({id:4,name:'John'});
var exist=$.grep(list, function(obj) {
return obj.name === 'sohel';
});
@sohel-rana
sohel-rana / arrayOfObjectsExtjsAjax.js
Last active December 20, 2015 13:29
Example of sending array of objects in ExtJS ajax requests.
var users = [];
var data1 = {
name: 'sohel'
age: 30
editor: 'phpstorm'
};
var data2 = {
name: 'Riad'
@sohel-rana
sohel-rana / Websites.js
Last active December 21, 2015 20:48
Using anonymous self excuting function for object property in javascript
var object = {
name: 'Sohel',
value: function(){
//anonymous self executing function
//split the websites
var websites = "http://www.lewishamilton.com http://www.twitter.com/lewishamilton http://instagram.com/lewishamilton www.youtube.com/lewishamilton https://plus.google.com/+LewisHamilton/posts";
var websiteArray = [];
$.each(websites, function(index, w) {
// format the web url as link
w = '<a target="_blank" href="' + w + '">' + w + '</a>';
@sohel-rana
sohel-rana / DynamicStore.js
Last active May 26, 2023 12:59
Fill data dynamically in an ExtJS data store
//take an array to store the object that we will get from the ajax response
var records = [];
//create extjs store with empty data
var store = Ext.create('Ext.data.Store',{
fields : ['id','name'],
data: records,
paging : false
});
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="CPH" runat="server"></asp:contentplaceholder>
</div>
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CPH" Runat="Server">
<asp:TextBox ID="txtName" runat="server"></asp:TextBox>
<asp:TextBox ID="txtAge" runat="server"></asp:TextBox>
<asp:Button ID="btnShow" runat="server" Text="Show " OnClientClick="IDIssue();"/>
</asp:Content>
ContentPlaceHolder cp = (ContentPlaceHolder)Page.Master.FindControl("CPH");
TextBox tbName = (TextBox)cp.FindControl("txtName");
TextBox tbAge = (TextBox)cp.FindControl("txtAge");
string script=string.Format(@"function IDIssue() {{ var txtName=document.getElementById('{0}'); var txtAge=document.getElementById('{1}'); alert('your name is '+ txtName.value+' and age is '+txtAge.value); }}",tbName.ClientID, tbAge.ClientID);
ClientScript.RegisterClientScriptBlock(this.GetType(), "IDIssue", script, true);