<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Tech Blog @Maddyone</title>
    <description>Articles on Node.js ,JavaScript, Angular, React and HTML5
</description>
    <link>http://tech-blog.maddyzone.com/</link>
    <atom:link href="http://tech-blog.maddyzone.com/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 08 Jul 2026 13:27:10 +0000</pubDate>
    <lastBuildDate>Wed, 08 Jul 2026 13:27:10 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Building ResumeTailorAI with Claude Code - A Complete AI-Powered Resume Optimization Platform</title>
        <description>&lt;h1 id=&quot;building-resumetailorai-with-claude-code-from-idea-to-deployment&quot;&gt;Building ResumeTailorAI with Claude Code: From Idea to Deployment&lt;/h1&gt;

&lt;p&gt;In today’s competitive job market, having a perfectly tailored resume for each job application isn’t just helpful—it’s essential. That’s why I built &lt;strong&gt;&lt;a href=&quot;https://www.resumetailorai.net/&quot;&gt;ResumeTailorAI&lt;/a&gt;&lt;/strong&gt;, an intelligent platform that automatically optimizes resumes for specific job descriptions using AI. What makes this journey special? I built the entire application using Claude Code, Anthropic’s powerful AI coding assistant.&lt;/p&gt;

&lt;h2 id=&quot;what-is-resumetailorai&quot;&gt;What is ResumeTailorAI?&lt;/h2&gt;

&lt;p&gt;&lt;a href=&quot;https://www.resumetailorai.net/&quot;&gt;ResumeTailorAI&lt;/a&gt; is a web application that helps job seekers optimize their resumes for specific positions. Simply upload your resume and the job description, and the AI analyzes both to create a perfectly tailored version that highlights your most relevant skills and experiences.&lt;/p&gt;

&lt;h3 id=&quot;key-features&quot;&gt;Key Features&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Smart Resume Analysis&lt;/strong&gt;: AI-powered parsing of your resume to understand your skills, experiences, and achievements&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Job Description Matching&lt;/strong&gt;: Intelligent matching algorithm that identifies key requirements and keywords from job postings&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;ATS Optimization&lt;/strong&gt;: Ensures your resume passes through Applicant Tracking Systems with optimized formatting and keywords&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Real-time Suggestions&lt;/strong&gt;: Get instant feedback on how to improve your resume for specific roles&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Multiple Format Support&lt;/strong&gt;: Works with PDF, DOCX, and plain text resumes&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Privacy-First Design&lt;/strong&gt;: Your data is processed securely and never stored permanently&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;the-power-of-claude-code&quot;&gt;The Power of Claude Code&lt;/h2&gt;

&lt;p&gt;Building a full-stack application usually requires months of development, debugging, and testing. With Claude Code, I transformed this timeline dramatically. Here’s how Claude Code revolutionized my development process:&lt;/p&gt;

&lt;h3 id=&quot;1-rapid-prototyping&quot;&gt;1. Rapid Prototyping&lt;/h3&gt;

&lt;p&gt;Claude Code helped me go from concept to working prototype in just hours. By describing what I wanted to build, Claude Code generated the initial project structure, set up the development environment, and created the foundational components.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Example: Claude Code helped create this resume parser in minutes&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseResume&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resumeFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;extractText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resumeFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sections&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;identifySections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;skills&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;extractSkills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;experience&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseExperience&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;skills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;experience&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;education&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseEducation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;generateSummary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;2-complex-algorithm-implementation&quot;&gt;2. Complex Algorithm Implementation&lt;/h3&gt;

&lt;p&gt;The core matching algorithm that compares resumes with job descriptions involves natural language processing and semantic analysis. Claude Code not only implemented these complex algorithms but also optimized them for performance:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Intelligent keyword matching algorithm created with Claude Code&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;calculateRelevanceScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;resumeKeywords&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;extractKeywords&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobKeywords&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;extractKeywords&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;semanticScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;calculateSemanticSimilarity&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;resumeKeywords&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;jobKeywords&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;skillMatchScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;matchSkills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;skills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;jobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;requirements&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;overall&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;semanticScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.6&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;skillMatchScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;details&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;semantic&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;semanticScore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;skills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;skillMatchScore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;suggestions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;generateImprovements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;3-full-stack-development&quot;&gt;3. Full-Stack Development&lt;/h3&gt;

&lt;p&gt;Claude Code seamlessly handled both frontend and backend development:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frontend (Next.js + React):&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Created responsive UI components&lt;/li&gt;
  &lt;li&gt;Implemented drag-and-drop file upload&lt;/li&gt;
  &lt;li&gt;Built real-time preview functionality&lt;/li&gt;
  &lt;li&gt;Designed mobile-responsive layouts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Backend (Node.js + API Routes):&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Set up secure API endpoints&lt;/li&gt;
  &lt;li&gt;Implemented file processing pipelines&lt;/li&gt;
  &lt;li&gt;Created AI integration layers&lt;/li&gt;
  &lt;li&gt;Built robust error handling&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;4-deployment-and-devops&quot;&gt;4. Deployment and DevOps&lt;/h3&gt;

&lt;p&gt;Perhaps most impressively, Claude Code guided me through the entire deployment process:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Environment Setup&lt;/strong&gt;: Configured production environment variables and security settings&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Build Optimization&lt;/strong&gt;: Implemented code splitting and lazy loading for optimal performance&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;CI/CD Pipeline&lt;/strong&gt;: Set up automated testing and deployment workflows&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Monitoring&lt;/strong&gt;: Integrated analytics and error tracking&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;the-development-journey&quot;&gt;The Development Journey&lt;/h2&gt;

&lt;h3 id=&quot;day-1-conceptualization-and-setup&quot;&gt;Day 1: Conceptualization and Setup&lt;/h3&gt;

&lt;p&gt;I started by describing my vision to Claude Code: “I want to build a web app that helps people tailor their resumes for specific job applications using AI.” Within minutes, Claude Code had:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Created a Next.js project with TypeScript&lt;/li&gt;
  &lt;li&gt;Set up Tailwind CSS for styling&lt;/li&gt;
  &lt;li&gt;Configured ESLint and Prettier&lt;/li&gt;
  &lt;li&gt;Initialized a Git repository&lt;/li&gt;
  &lt;li&gt;Created the initial project structure&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;day-2-3-core-functionality&quot;&gt;Day 2-3: Core Functionality&lt;/h3&gt;

&lt;p&gt;Claude Code helped implement the core features:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Resume optimization engine&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;optimizeResume&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;originalResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;// Extract key information&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;resumeData&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;originalResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobRequirements&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;analyzeJobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;jobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  
  &lt;span class=&quot;c1&quot;&gt;// Generate optimized content&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;optimizedSections&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tailorSummary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resumeData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;summary&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobRequirements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;experience&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;enhanceExperience&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resumeData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;experience&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobRequirements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;skills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;prioritizeSkills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;resumeData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;skills&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;jobRequirements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;keywords&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;achievements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;highlightRelevantAchievements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;resumeData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;achievements&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;jobRequirements&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
  
  &lt;span class=&quot;c1&quot;&gt;// Format for ATS compatibility&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;formatForATS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;optimizedSections&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;day-4-5-uiux-polish&quot;&gt;Day 4-5: UI/UX Polish&lt;/h3&gt;

&lt;p&gt;Claude Code created an intuitive user interface:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Clean, professional design&lt;/li&gt;
  &lt;li&gt;Step-by-step wizard for first-time users&lt;/li&gt;
  &lt;li&gt;Real-time preview of changes&lt;/li&gt;
  &lt;li&gt;Download options in multiple formats&lt;/li&gt;
  &lt;li&gt;Mobile-responsive design&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;day-6-testing-and-optimization&quot;&gt;Day 6: Testing and Optimization&lt;/h3&gt;

&lt;p&gt;Claude Code implemented comprehensive testing:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Automated testing suite&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;describe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;Resume Optimization&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;should identify relevant keywords&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;optimizeResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mockResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mockJobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;keywords&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toContain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;machine learning&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;score&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toBeGreaterThan&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
  
  &lt;span class=&quot;nx&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;should maintain ATS compatibility&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;async&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;await&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;optimizeResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mockResume&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mockJobDescription&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;atsScore&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;checkATSCompatibility&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;expect&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;atsScore&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;toBeGreaterThan&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;day-7-deployment&quot;&gt;Day 7: Deployment&lt;/h3&gt;

&lt;p&gt;Claude Code guided the deployment to production:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Set up Vercel for hosting&lt;/li&gt;
  &lt;li&gt;Configured custom domain (www.resumetailorai.net)&lt;/li&gt;
  &lt;li&gt;Implemented SSL and security headers&lt;/li&gt;
  &lt;li&gt;Set up monitoring and analytics&lt;/li&gt;
  &lt;li&gt;Created backup and recovery procedures&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;technical-architecture&quot;&gt;Technical Architecture&lt;/h2&gt;

&lt;p&gt;ResumeTailorAI is built with modern web technologies:&lt;/p&gt;

&lt;h3 id=&quot;frontend-stack&quot;&gt;Frontend Stack&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Next.js 14&lt;/strong&gt;: For server-side rendering and optimal performance&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;React&lt;/strong&gt;: Component-based UI architecture&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Tailwind CSS&lt;/strong&gt;: Utility-first styling&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Framer Motion&lt;/strong&gt;: Smooth animations and transitions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;backend-stack&quot;&gt;Backend Stack&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Node.js&lt;/strong&gt;: Server runtime&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Next.js API Routes&lt;/strong&gt;: Serverless functions&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;OpenAI API&lt;/strong&gt;: For AI-powered analysis&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;PDF.js&lt;/strong&gt;: Document processing&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;infrastructure&quot;&gt;Infrastructure&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Vercel&lt;/strong&gt;: Hosting and edge functions&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Cloudflare&lt;/strong&gt;: CDN and DDoS protection&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;MongoDB Atlas&lt;/strong&gt;: Database for user sessions&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;AWS S3&lt;/strong&gt;: Temporary file storage&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;how-resumetailorai-works&quot;&gt;How ResumeTailorAI Works&lt;/h2&gt;

&lt;h3 id=&quot;step-1-upload-your-documents&quot;&gt;Step 1: Upload Your Documents&lt;/h3&gt;
&lt;p&gt;Users upload their current resume and the job description they’re targeting. The system accepts multiple file formats and ensures secure handling of personal data.&lt;/p&gt;

&lt;h3 id=&quot;step-2-ai-analysis&quot;&gt;Step 2: AI Analysis&lt;/h3&gt;
&lt;p&gt;The AI engine analyzes both documents, identifying:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Key skills and requirements from the job description&lt;/li&gt;
  &lt;li&gt;Relevant experiences and achievements from the resume&lt;/li&gt;
  &lt;li&gt;Gaps that need to be addressed&lt;/li&gt;
  &lt;li&gt;Keywords for ATS optimization&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;step-3-intelligent-optimization&quot;&gt;Step 3: Intelligent Optimization&lt;/h3&gt;
&lt;p&gt;The system generates an optimized version of the resume that:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Emphasizes relevant experiences&lt;/li&gt;
  &lt;li&gt;Incorporates important keywords naturally&lt;/li&gt;
  &lt;li&gt;Restructures content for maximum impact&lt;/li&gt;
  &lt;li&gt;Ensures ATS compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;step-4-review-and-download&quot;&gt;Step 4: Review and Download&lt;/h3&gt;
&lt;p&gt;Users can:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Preview the optimized resume&lt;/li&gt;
  &lt;li&gt;Make manual adjustments if needed&lt;/li&gt;
  &lt;li&gt;Download in their preferred format&lt;/li&gt;
  &lt;li&gt;Get additional tips for improvement&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;real-user-impact&quot;&gt;Real User Impact&lt;/h2&gt;

&lt;p&gt;Since launching, ResumeTailorAI has helped thousands of job seekers:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;85% higher response rate&lt;/strong&gt; on job applications&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;3x more interview invitations&lt;/strong&gt; on average&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;60% reduction&lt;/strong&gt; in time spent customizing resumes&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;92% user satisfaction&lt;/strong&gt; rate&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;success-story&quot;&gt;Success Story&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;“I was applying to dozens of jobs with the same generic resume and getting nowhere. ResumeTailorAI helped me create targeted resumes for each application. Within two weeks, I had five interview calls and eventually landed my dream job at a Fortune 500 company!”&lt;/em&gt; - Sarah K., Software Engineer&lt;/p&gt;

&lt;h2 id=&quot;lessons-learned&quot;&gt;Lessons Learned&lt;/h2&gt;

&lt;p&gt;Building ResumeTailorAI with Claude Code taught me valuable lessons:&lt;/p&gt;

&lt;h3 id=&quot;1-ai-accelerates-development&quot;&gt;1. AI Accelerates Development&lt;/h3&gt;
&lt;p&gt;What would typically take months was accomplished in a week. Claude Code didn’t just write code—it architected solutions, debugged issues, and optimized performance.&lt;/p&gt;

&lt;h3 id=&quot;2-iterative-development-is-key&quot;&gt;2. Iterative Development is Key&lt;/h3&gt;
&lt;p&gt;Claude Code excels at iterative improvements. I could describe what I wanted to change, and it would refactor the code while maintaining functionality.&lt;/p&gt;

&lt;h3 id=&quot;3-documentation-matters&quot;&gt;3. Documentation Matters&lt;/h3&gt;
&lt;p&gt;Claude Code automatically generated comprehensive documentation, making the codebase maintainable and scalable.&lt;/p&gt;

&lt;h3 id=&quot;4-testing-is-crucial&quot;&gt;4. Testing is Crucial&lt;/h3&gt;
&lt;p&gt;Claude Code emphasized test-driven development, creating unit tests, integration tests, and end-to-end tests that ensure reliability.&lt;/p&gt;

&lt;h2 id=&quot;future-enhancements&quot;&gt;Future Enhancements&lt;/h2&gt;

&lt;p&gt;The journey doesn’t end here. Planned features include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Cover Letter Generation&lt;/strong&gt;: AI-powered cover letters tailored to each application&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;LinkedIn Optimization&lt;/strong&gt;: Suggestions for improving LinkedIn profiles&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Interview Preparation&lt;/strong&gt;: AI mock interviews based on the job description&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Career Path Analysis&lt;/strong&gt;: Recommendations for skill development based on career goals&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Multi-language Support&lt;/strong&gt;: Supporting resumes in multiple languages&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;tips-for-building-with-claude-code&quot;&gt;Tips for Building with Claude Code&lt;/h2&gt;

&lt;p&gt;If you’re planning to build your own application with Claude Code, here are my top tips:&lt;/p&gt;

&lt;h3 id=&quot;1-start-with-clear-requirements&quot;&gt;1. Start with Clear Requirements&lt;/h3&gt;
&lt;p&gt;Be specific about what you want to build. The clearer your vision, the better Claude Code can help.&lt;/p&gt;

&lt;h3 id=&quot;2-iterate-frequently&quot;&gt;2. Iterate Frequently&lt;/h3&gt;
&lt;p&gt;Don’t try to build everything at once. Work in small increments and test frequently.&lt;/p&gt;

&lt;h3 id=&quot;3-leverage-claudes-expertise&quot;&gt;3. Leverage Claude’s Expertise&lt;/h3&gt;
&lt;p&gt;Claude Code knows best practices and design patterns. Trust its suggestions for architecture and implementation.&lt;/p&gt;

&lt;h3 id=&quot;4-focus-on-user-experience&quot;&gt;4. Focus on User Experience&lt;/h3&gt;
&lt;p&gt;Claude Code can handle the technical complexity, allowing you to focus on creating the best user experience.&lt;/p&gt;

&lt;h3 id=&quot;5-test-thoroughly&quot;&gt;5. Test Thoroughly&lt;/h3&gt;
&lt;p&gt;Use Claude Code to create comprehensive test suites. It’s excellent at identifying edge cases you might miss.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Building &lt;a href=&quot;https://www.resumetailorai.net/&quot;&gt;ResumeTailorAI&lt;/a&gt; with Claude Code has been an incredible journey. In just one week, I went from an idea to a fully functional, production-ready application that’s helping thousands of job seekers land their dream jobs.&lt;/p&gt;

&lt;p&gt;Claude Code isn’t just a coding assistant—it’s a development partner that understands context, suggests improvements, and helps you build better software faster. Whether you’re a seasoned developer or just starting out, Claude Code can help you bring your ideas to life.&lt;/p&gt;

&lt;p&gt;The future of software development is here, and it’s powered by AI. ResumeTailorAI is proof that with the right tools and vision, anyone can build impactful applications that solve real-world problems.&lt;/p&gt;

&lt;h3 id=&quot;try-resumetailorai-today&quot;&gt;Try ResumeTailorAI Today!&lt;/h3&gt;

&lt;p&gt;Ready to optimize your resume and land your dream job? Visit &lt;strong&gt;&lt;a href=&quot;https://www.resumetailorai.net/&quot;&gt;www.resumetailorai.net&lt;/a&gt;&lt;/strong&gt; and experience the power of AI-driven resume optimization.&lt;/p&gt;

&lt;h3 id=&quot;get-started-with-claude-code&quot;&gt;Get Started with Claude Code&lt;/h3&gt;

&lt;p&gt;Want to build your own AI-powered application? Start your journey with Claude Code and transform your ideas into reality. The only limit is your imagination.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;&lt;em&gt;Have questions or feedback about ResumeTailorAI? Feel free to reach out or leave a comment below. Happy job hunting!&lt;/em&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 07 Jan 2025 10:00:00 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/ai/web%20development/claude%20code/building-resumetailorai-with-claude-code</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/ai/web%20development/claude%20code/building-resumetailorai-with-claude-code</guid>
        
        <category>AI</category>
        
        <category>Resume Builder</category>
        
        <category>Claude Code</category>
        
        <category>Next.js</category>
        
        <category>Full Stack Development</category>
        
        <category>Anthropic</category>
        
        <category>Career Tools</category>
        
        
        <category>AI</category>
        
        <category>Web Development</category>
        
        <category>Claude Code</category>
        
      </item>
    
      <item>
        <title>An Introduction to Svelte, A Modern and Performant Front-End Framework</title>
        <description>&lt;h1 id=&quot;an-introduction-to-svelte&quot;&gt;An Introduction to Svelte&lt;/h1&gt;

&lt;p&gt;Svelte is a modern front-end framework for building web applications. What makes Svelte unique is its approach to building UIs. Rather than relying on a virtual DOM like other frameworks, Svelte compiles your code into efficient JavaScript that updates the real DOM directly. This results in faster and more performant applications.&lt;/p&gt;

&lt;h3 id=&quot;key-features-of-svelte&quot;&gt;Key Features of Svelte&lt;/h3&gt;

&lt;p&gt;Here are some of the key features of Svelte that make it a compelling option for building web applications:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Components: Svelte uses components to break down your application into smaller, reusable parts. Components can be nested, which allows you to build complex UIs out of smaller building blocks.&lt;/li&gt;
  &lt;li&gt;Reactive data: Svelte provides a simple and intuitive way of working with data that automatically updates the UI when the data changes. This eliminates the need for complex data binding or state management libraries.&lt;/li&gt;
  &lt;li&gt;Direct DOM manipulation: Instead of relying on a virtual DOM, Svelte updates the DOM directly, which can improve performance and reduce the size of your application bundle.&lt;/li&gt;
  &lt;li&gt;Animations: Svelte provides built-in support for animations, which makes it easy to create engaging and interactive UIs.&lt;/li&gt;
  &lt;li&gt;Server-side rendering: Svelte supports server-side rendering, which can improve the performance and SEO of your application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To get started with Svelte, you’ll first need to create a new Svelte project. You can do this using the command line interface with the following commands:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npx degit sveltejs/template my-svelte-app
cd my-svelte-app
npm install
npm run dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will create a new Svelte project in a directory called &lt;strong&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;my-svelte-app&lt;/code&gt;&lt;/strong&gt;, install the necessary dependencies, and start a local development server.&lt;/p&gt;

&lt;p&gt;Once you have a new project set up, you can create components. Components are reusable building blocks that make up your UI. Here’s an example of a simple Svelte component:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;!-- Counter.svelte --&amp;gt;
&amp;lt;script&amp;gt;
  // Define some reactive data
  let count = 0;

  // Define a function to update the count
  function increment() {
    count += 1;
  }
&amp;lt;/script&amp;gt;

&amp;lt;button on:click={increment}&amp;gt;
  Clicked {count} {count === 1 ? &apos;time&apos; : &apos;times&apos;}
&amp;lt;/button&amp;gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this component, we define some reactive data (in this case, a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;count&lt;/code&gt; variable) that will automatically update the UI whenever its value changes. We also define a function called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;increment&lt;/code&gt; that updates the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;count&lt;/code&gt; variable when the button is clicked.&lt;/p&gt;

&lt;p&gt;To use this component in your application, you would simply import it and add it to your app:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;!-- App.svelte --&amp;gt;

&amp;lt;script&amp;gt;
  import Counter from &apos;./Counter.svelte&apos;;
&amp;lt;/script&amp;gt;

&amp;lt;div&amp;gt;
  &amp;lt;Counter /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In this example, we import the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Counter&lt;/code&gt; component and add it to our app. When the component is rendered, it will display a button that updates the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;count&lt;/code&gt; variable when clicked.&lt;/p&gt;

&lt;p&gt;If you’re interested in trying out Svelte, the best place to start is the official Svelte website. The website provides a comprehensive guide to getting started with Svelte, including a tutorial for building your first application. There are also many resources available online, including blogs, videos, and courses, that can help you learn more about Svelte and how to use it to build web applications.&lt;/p&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Svelte is a new and exciting way of building web applications that provides a simpler, more intuitive way of working with UIs. Its unique approach to compiling declarative code into highly efficient JavaScript makes it a compelling option for developers looking to build fast and efficient web applications. If you’re looking for a new framework to try out, Svelte is definitely worth checking out!&lt;/p&gt;

</description>
        <pubDate>Mon, 01 May 2023 08:00:00 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/svelte/svelte-framework-introduction</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/svelte/svelte-framework-introduction</guid>
        
        <category>Svelte</category>
        
        <category>Front-End Framework</category>
        
        <category>Reactivity</category>
        
        <category>Performance</category>
        
        <category>Animations</category>
        
        
        <category>Svelte</category>
        
      </item>
    
      <item>
        <title>How to upload image in React Native App</title>
        <description>&lt;p&gt;&lt;img src=&quot;/uploads/2020/04/upload-image-in%20-react-native-app.png&quot; alt=&quot;upload image in React Native App&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Images play a big role to create beautiful apps. Today we will learn how to upload image in React Native App.&lt;/p&gt;

&lt;h1 id=&quot;setup&quot;&gt;Setup&lt;/h1&gt;
&lt;p&gt;To upload image we need to create two Project.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;A React Native app&lt;/li&gt;
  &lt;li&gt;A simple node server (where we upload the selected image)
    &lt;h1 id=&quot;1-first-we-will-set-up-a-react-native-app&quot;&gt;1 First we will set up a react native app.&lt;/h1&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;react-native init ImageUploadReactNative&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It will create a react native app with name &lt;strong&gt;ImageUploadReactNative&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;then run app in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ios&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ImageUploadReactNative;
cd ios // go to ios folder
pod install // pod install
cd.. // then back to current folder
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then we start our app for &lt;strong&gt;ios&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reac-native run-ios&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and for &lt;strong&gt;android&lt;/strong&gt;  we run this command.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reac-native run-android&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then in &lt;strong&gt;simulator&lt;/strong&gt; it will look like below .&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2020/04/Simulator Screen Shot - iPhone X - 2020-04-26 at 16.50.16.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2020/04/Simulator Screen Shot - iPhone X - 2020-04-26 at 16.50.16.png&quot; alt=&quot;App started&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;now-add-a-image-container-and-edit-button&quot;&gt;Now add a Image container and Edit Button&lt;/h2&gt;
&lt;p&gt;Ok now i am changing  &lt;strong&gt;app.js&lt;/strong&gt;  and adding&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;A &lt;strong&gt;Edit Button&lt;/strong&gt; - when we click on this button we trigger image picker by this we can choose image which we want to upload.&lt;/li&gt;
  &lt;li&gt;A &lt;strong&gt;Image Container&lt;/strong&gt; - on which we will show image. By default we are showing  a default image and when we choose another image using picker it will replace this default image.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;So first create this edit button and image container.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App.js&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;import React from &apos;react&apos;;
import {Header, Image} from &apos;react-native-elements&apos;;
import {StyleSheet, View, ActivityIndicator} from &apos;react-native&apos;;
import defaultAvatar from &apos;./profile.png&apos;;

const App = () =&amp;gt; {
  return (
    &amp;lt;View&amp;gt;
      &amp;lt;Header
        centerComponent={{
          text: &apos;Profile Photo&apos;,
          style: styles.headerText,
        }}
        rightComponent={{
          text: &apos;Edit&apos;,
          style: styles.headerText,
        }}
      /&amp;gt;
      &amp;lt;View style={styles.imageContainer}&amp;gt;
        &amp;lt;Image
          source={defaultAvatar}
          PlaceholderContent={&amp;lt;ActivityIndicator /&amp;gt;}
          style={{width: 400, height: 400}}
        /&amp;gt;
      &amp;lt;/View&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: &apos;center&apos;,
    justifyContent: &apos;center&apos;,
    height: &apos;100%&apos;,
  },
  imageContainer: {
    flex: 1,
    alignItems: &apos;center&apos;,
    justifyContent: &apos;center&apos;,
  },
  headerText: {
    color: &apos;#fff&apos;,
    fontSize: 20,
  },
  body: {flex: 1},
});

export default App;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And Now its look like below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/uploads/2020/04/profile.png&quot; alt=&quot;Profile Screen&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;setup-image-picker-to-choose-image-in-react-native-app&quot;&gt;SetUp Image Picker to choose Image in React Native App&lt;/h2&gt;

&lt;p&gt;So Now, To upload image we are using &lt;a href=&quot;https://www.npmjs.com/package/react-native-image-picker&quot;&gt;react-native-image-picker&lt;/a&gt; npm package.&lt;/p&gt;

&lt;p&gt;to use this package&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yarn add react-native-image-picker

# RN &amp;gt;= 0.60
cd ios &amp;amp;&amp;amp; pod install

# RN &amp;lt; 0.60
react-native link react-native-image-picker
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and after this you need to do several steps for &lt;strong&gt;iOS&lt;/strong&gt; and &lt;strong&gt;Android&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;iOS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSPhotoLibraryUsageDescription&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSCameraUsageDescription&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSPhotoLibraryAddUsageDescription&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NSMicrophoneUsageDescription&lt;/code&gt; (if allowing video) keys to your &lt;strong&gt;Info.plist&lt;/strong&gt; with strings describing why your app needs these permissions.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: You will get a SIGABRT crash if you don’t complete this step&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;plist version=&quot;1.0&quot;&amp;gt;
  &amp;lt;dict&amp;gt;
    ...
    &amp;lt;key&amp;gt;NSPhotoLibraryUsageDescription&amp;lt;/key&amp;gt;
    &amp;lt;string&amp;gt;$(PRODUCT_NAME) would like access to your photo gallery&amp;lt;/string&amp;gt;
    &amp;lt;key&amp;gt;NSCameraUsageDescription&amp;lt;/key&amp;gt;
    &amp;lt;string&amp;gt;$(PRODUCT_NAME) would like to use your camera&amp;lt;/string&amp;gt;
    &amp;lt;key&amp;gt;NSPhotoLibraryAddUsageDescription&amp;lt;/key&amp;gt;
    &amp;lt;string&amp;gt;$(PRODUCT_NAME) would like to save photos to your photo gallery&amp;lt;/string&amp;gt;
    &amp;lt;key&amp;gt;NSMicrophoneUsageDescription&amp;lt;/key&amp;gt;
    &amp;lt;string&amp;gt;$(PRODUCT_NAME) would like to use your microphone (for videos)&amp;lt;/string&amp;gt;
  &amp;lt;/dict&amp;gt;
&amp;lt;/plist&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Android&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Add the required permissions in AndroidManifest.xml:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&amp;gt;
&amp;lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot;/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So your files will looks like below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/uploads/2020/04/react-native-image-picker-setting.png&quot; alt=&quot;react-native-image-picker-setting&quot; /&gt;&lt;/p&gt;

&lt;p&gt;So Now in  &lt;strong&gt;app.js&lt;/strong&gt;  first we import &lt;strong&gt;react-native-image-picker&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;import ImagePicker from &apos;react-native-image-picker&apos;;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then on &lt;strong&gt;Edit&lt;/strong&gt; button click we  call method  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;handlePicker&lt;/code&gt; . So overall Code is in &lt;strong&gt;App.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;import React, {useState} from &apos;react&apos;;
import {Header, Image} from &apos;react-native-elements&apos;;
import {StyleSheet, View, ActivityIndicator} from &apos;react-native&apos;;
import defaultAvatar from &apos;./profile.png&apos;;
import ImagePicker from &apos;react-native-image-picker&apos;;

const App = () =&amp;gt; {
  const [avatar, setAvatar] = useState(defaultAvatar);

  const handlePicker = () =&amp;gt; {
    // console.log(&apos;edit&apos;);
    ImagePicker.showImagePicker({}, (response) =&amp;gt; {
      console.log(&apos;Response = &apos;, response);

      if (response.didCancel) {
        console.log(&apos;User cancelled image picker&apos;);
      } else if (response.error) {
        console.log(&apos;ImagePicker Error: &apos;, response.error);
      } else if (response.customButton) {
        console.log(&apos;User tapped custom button: &apos;, response.customButton);
      } else {
        setAvatar({uri: response.uri});
        // here we can call a API to upload image on server
      }
    });
  };

  return (
    &amp;lt;View&amp;gt;
      &amp;lt;Header
        centerComponent={{
          text: &apos;Profile Photo&apos;,
          style: styles.headerText,
        }}
        rightComponent={{
          text: &apos;Edit&apos;,
          style: styles.headerText,
          onPress: () =&amp;gt; handlePicker(),
        }}
      /&amp;gt;
      &amp;lt;View style={styles.imageContainer}&amp;gt;
        &amp;lt;Image
          source={avatar}
          PlaceholderContent={&amp;lt;ActivityIndicator /&amp;gt;}
          style={{width: 500, height: 500}}
        /&amp;gt;
      &amp;lt;/View&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: &apos;center&apos;,
    justifyContent: &apos;center&apos;,
    height: &apos;100%&apos;,
  },
  imageContainer: {
    flex: 1,
    alignItems: &apos;center&apos;,
    justifyContent: &apos;center&apos;,
  },
  headerText: {
    color: &apos;#fff&apos;,
    fontSize: 20,
  },
  body: {flex: 1},
});

export default App;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setAvatar({uri: response.uri});&lt;/code&gt;
here we can call a API to upload image on server&lt;/p&gt;

&lt;h1 id=&quot;2-now-setup-a-node-js-server-to-upload-selected-image&quot;&gt;2 Now Setup a Node JS server to upload selected image&lt;/h1&gt;

&lt;p&gt;So in second terminal we will execute these command to create node server&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cd ImageUploadReactNative
mkdir server
cd server
mkdir images
npm init // answer the questions which comes on terminal
npm install --save express body-parser multer
touch index.js
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then in index.js we set this below code&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;index.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;const Express = require(&apos;express&apos;);
const multer = require(&apos;multer&apos;);
const bodyParser = require(&apos;body-parser&apos;);

const app = Express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
multer({
  limits: {fieldSize: 25 * 1024 * 1024},
});

const Storage = multer.diskStorage({
  destination(req, file, callback) {
    callback(null, &apos;./images&apos;);
  },
  filename(req, file, callback) {
    callback(null, `${file.fieldname}_${Date.now()}_${file.originalname}`);
  },
});

app.get(&apos;/&apos;, (req, res) =&amp;gt; {
  res.status(200).send(&apos;to upload image use this  /api/upload.&apos;);
});

app.post(&apos;/api/upload&apos;, (req, res) =&amp;gt; {
  let upload = multer({storage: Storage}).single(&apos;picture&apos;);
  upload(req, res, function (err) {
    if (!req.file) {
      return res.send(&apos;Please select an image to upload&apos;);
    } else if (err instanceof multer.MulterError) {
      return res.send(err);
    } else if (err) {
      return res.send(err);
    }
    // Display uploaded image for user validation
    res.send(req.file.path); // send uploaded image
  });
});

app.listen(3000, () =&amp;gt; {
  console.log(&apos;App running on http://localhost:3000&apos;);
});


&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now this is related to the server (Node.js)  which is not in the scope of this tutorial.&lt;/p&gt;

&lt;p&gt;Finally, you can run the  &lt;strong&gt;Node Server&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;node index.js

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;so in react native code where we are calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setAvatar({uri: response.uri});&lt;/code&gt;  after that we send request to server so now overall code in &lt;strong&gt;app.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;import React, {useState} from &apos;react&apos;;
import {Header, Image} from &apos;react-native-elements&apos;;
import {StyleSheet, View, ActivityIndicator, Platform} from &apos;react-native&apos;;
import defaultAvatar from &apos;./profile.png&apos;;
import ImagePicker from &apos;react-native-image-picker&apos;;

const createFormData = (photo, body) =&amp;gt; {
  const data = new FormData();

  data.append(&apos;photo&apos;, {
    name: photo.fileName,
    type: photo.type,
    uri:
      Platform.OS === &apos;android&apos; ? photo.uri : photo.uri.replace(&apos;file://&apos;, &apos;&apos;),
  });

  Object.keys(body).forEach((key) =&amp;gt; {
    data.append(key, body[key]);
  });

  return data;
};

const App = () =&amp;gt; {
  const [avatar, setAvatar] = useState(defaultAvatar);
  const [title, setTitle] = useState(&apos;Profile Photo&apos;);
  const handlePicker = () =&amp;gt; {
    ImagePicker.showImagePicker({}, (response) =&amp;gt; {
      console.log(&apos;Response = &apos;, response);

      if (response.didCancel) {
        console.log(&apos;User cancelled image picker&apos;);
      } else if (response.error) {
        console.log(&apos;ImagePicker Error: &apos;, response.error);
      } else if (response.customButton) {
        console.log(&apos;User tapped custom button: &apos;, response.customButton);
      } else {
        setAvatar({uri: response.uri});
        setTitle(&apos;Updating...&apos;); // image start to upload on server so on header set text is &apos;Updating..&apos;
        fetch(&apos;http://localhost:3000/api/upload&apos;, {
          method: &apos;POST&apos;,
          headers: new Headers({
            &apos;Content-Type&apos;: &apos;application/x-www-form-urlencoded&apos;, //Specifying the Content-Type
          }),
          body: createFormData(response, {id: &apos;123&apos;}),
        })
          .then((data) =&amp;gt; data.json())
          .then((res) =&amp;gt; {
            console.log(&apos;upload succes&apos;, res);
            setTitle(&apos;Profile Photo&apos;);
            setAvatar({uri: response.image});
          })
          .catch((error) =&amp;gt; {
            console.log(&apos;upload error&apos;, error);
            setTitle(&apos;Profile Photo&apos;);
          });
      }
    });
  };

  return (
    &amp;lt;View&amp;gt;
      &amp;lt;Header
        centerComponent={{
          text: title,
          style: styles.headerText,
        }}
        rightComponent={{
          text: &apos;Edit&apos;,
          style: styles.headerText,
          onPress: () =&amp;gt; handlePicker(),
        }}
      /&amp;gt;
      &amp;lt;View style={styles.imageContainer}&amp;gt;
        &amp;lt;Image
          source={avatar}
          PlaceholderContent={&amp;lt;ActivityIndicator /&amp;gt;}
          style={{width: 500, height: 500}}
        /&amp;gt;
      &amp;lt;/View&amp;gt;
    &amp;lt;/View&amp;gt;
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: &apos;center&apos;,
    justifyContent: &apos;center&apos;,
    height: &apos;100%&apos;,
  },
  imageContainer: {
    flex: 1,
    alignItems: &apos;center&apos;,
    justifyContent: &apos;center&apos;,
  },
  headerText: {
    color: &apos;#fff&apos;,
    fontSize: 20,
  },
  body: {flex: 1},
});

export default App;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So it’s Looks like below.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/uploads/2020/04/image-upload-demo.gif&quot; alt=&quot;Image Upload Demo&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/riturajratan/ImageUploadReactNative&quot;&gt;Download  Code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Please give your comments and suggestion below.&lt;/p&gt;

&lt;p&gt;Thanks .&lt;/p&gt;
</description>
        <pubDate>Mon, 27 Apr 2020 13:55:35 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/reactnative/how-to-upload-image-in-react-native-app</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/reactnative/how-to-upload-image-in-react-native-app</guid>
        
        <category>ReactNative</category>
        
        <category>ImageUpload</category>
        
        <category>reactnativeimageupload</category>
        
        <category>react-native-image-picker</category>
        
        
        <category>ReactNative</category>
        
      </item>
    
      <item>
        <title>Lint files before commit</title>
        <description>&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2019/09/lint.gif&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2019/09/lint.gif&quot; alt=&quot;Linting before commit&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ya so after a long long time I am back :)&lt;/p&gt;

&lt;p&gt;So most of the time, we have an issue that why our friends commit files with errors like&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;linting is not done .&lt;/li&gt;
  &lt;li&gt;without proper indentation.&lt;/li&gt;
  &lt;li&gt;and bla bla bla.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So for this we can set-up some hooks in git so when someone works on any files and tries to commit then first he needs to resolve all errors after that he can commit by this, code quality is also improved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requirement :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;so for this we need to install 2 packages in our dev dependencies.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.npmjs.com/package/husky&quot; target=&quot;_blank&quot;&gt; husky&lt;/a&gt; (npm install husky –save-dev)&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.npmjs.com/package/lint-staged&quot; target=&quot;_blank&quot;&gt; lint-staged &lt;/a&gt; (npm install lint-staged  –save-dev)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Setup :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So in our package.json file, we need to setup like below Here I am taking two configurations for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tslint&lt;/code&gt; and for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Eslint&lt;/code&gt;.
As most of the time, we are working in angular.js and react.js ;). I am assuming that my all files in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;src&lt;/code&gt; folder. &lt;/p&gt;

&lt;h3 id=&quot;for-tslint&quot;&gt;for TSlint&lt;/h3&gt;

&lt;p&gt;so for this we need to install additionally &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tslint&lt;/code&gt; package as it mention below in devDependencies&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;w&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;test tslint&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;private&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//your&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;dependencies&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;devDependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;husky&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^3.0.3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lint-staged&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^9.2.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;tslint&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^5.8.0&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;husky&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;pre-commit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;lint-staged&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lint-staged&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;{src}/**/*.{js,ts}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;tslint -c tslint.json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;git add&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;for-eslint&quot;&gt;for ESlint&lt;/h3&gt;
&lt;p&gt;so for this we need to install additionally &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;eslint&lt;/code&gt; package as it mention below in devDependencies&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-json&quot; data-lang=&quot;json&quot;&gt;&lt;span class=&quot;w&quot;&gt;   &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
     &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;test tslint&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;private&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
   
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;//your&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;dependencies&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;devDependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;husky&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^3.0.3&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lint-staged&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^9.2.1&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;eslint&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^5.16.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;husky&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;hooks&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;pre-commit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;lint-staged&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lint-staged&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;**/{src,lib}/**/*.{js,jsx}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;eslint --fix&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;git add&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Please give your comments and suggestion below.&lt;/p&gt;

&lt;p&gt;Thanks .&lt;/p&gt;
</description>
        <pubDate>Sun, 08 Sep 2019 21:36:48 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/javascript/lint-files-before-commit</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/javascript/lint-files-before-commit</guid>
        
        <category>JavaScript</category>
        
        <category>TypeScript</category>
        
        <category>EcmaScript</category>
        
        <category>hooks</category>
        
        
        <category>JavaScript</category>
        
      </item>
    
      <item>
        <title>How to reload current route in angular 2</title>
        <description>&lt;p&gt;Most of the time we need to reload current URL with angular 2 but as there is no option so there are some tips to do that. So let’s start we will check one by one.&lt;/p&gt;

&lt;h2 id=&quot;reload-current-route-with-some-dummy-parameter&quot;&gt;Reload current route with some dummy parameter&lt;/h2&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;nx&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;([&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/same/route/path?refresh=1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So now you can update &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;refresh&lt;/code&gt; query parameter value and subscribe it in following way.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;route&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;queryParams&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;subscribe&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;refresh&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;here can start your work and call init method&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;   &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So if your all work start from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; method then that would be easy to call again  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; method. So here actually route is not reload you just got an event by this you trigger &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;init&lt;/code&gt; method again.&lt;/p&gt;

&lt;p&gt;Pros: You call init method and things are done.
&lt;br /&gt;
Cons: if your route using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Reslover&lt;/code&gt; then how will &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Resolver&lt;/code&gt; data update? For this we are using next below trick :).&lt;/p&gt;

&lt;h2 id=&quot;reload-current-route-with-some-dummy-route&quot;&gt;Reload current route with some dummy route&lt;/h2&gt;

&lt;p&gt;I prefer this way because by this all route will reload and thinks done automatically and in all project, you can use this thing and no worry about reload route. So basically, we need to create a blank component and set a route for this like below&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nl&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;blank&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;component&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;BlankComponent&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So now like I want to refresh my route then I will subscribe this route and when it will come this subscribe callback I will navigate to current URL and it will run. So first it goes to blank route and then come to this route so all things reset according to current route :)&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;   &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigateByUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;blank&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;then&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
          &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;router&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;navigateByUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;same/route/path`);
          console.log(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;naviate&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;any&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;route&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;which&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;you&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;want&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;);
    });&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;for any query, please comment or feedback me for this blog, how do you like this.&lt;/p&gt;

</description>
        <pubDate>Tue, 06 Feb 2018 12:49:52 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/angularjs/javascript/how-reload-current-route-angular2</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/angularjs/javascript/how-reload-current-route-angular2</guid>
        
        <category>refresh route</category>
        
        <category>route reload</category>
        
        <category>router</category>
        
        <category>reload current route</category>
        
        <category>refresh current route</category>
        
        <category>Angular2</category>
        
        <category>Angular</category>
        
        
        <category>AngularJS</category>
        
        <category>JavaScript</category>
        
      </item>
    
      <item>
        <title>How to set absolute and relative url in angular2</title>
        <description>&lt;p&gt;Most of the time we need to set url somtimes its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Absolute&lt;/code&gt; or some times its &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Relative&lt;/code&gt;.
so lets start we will check one by one.&lt;/p&gt;

&lt;h2 id=&quot;how-to-set-absolute-url&quot;&gt;How to set Absolute URL&lt;/h2&gt;

&lt;blockquote&gt;To set Absolute url we need to set `/` in starting of url by this url behave as Absolute.&lt;/blockquote&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;/user&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now if we are on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://www.maddyzone.com/home&lt;/code&gt;  then it will redirect to  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://www.maddyzone.com/user&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;how-to-set-relative-url&quot;&gt;How to set Relative URL&lt;/h2&gt;

&lt;blockquote&gt;To set Relative url we no need to set `/` in starting of url by this url behave as Relative.&lt;/blockquote&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;&lt;span class=&quot;nt&quot;&gt;&amp;lt;a&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;href=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;user&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Now if we are on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://www.maddyzone.com/home&lt;/code&gt;  then it will redirect to  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://www.maddyzone.com/home/user&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;for any query , please comment or feedback me for this blog , how do you like this.&lt;/p&gt;
</description>
        <pubDate>Sat, 17 Jun 2017 19:49:52 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/angularjs/javascript/absolute-relative-url-in-angular2</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/angularjs/javascript/absolute-relative-url-in-angular2</guid>
        
        <category>relative url</category>
        
        <category>absolute url</category>
        
        <category>Angular2</category>
        
        
        <category>AngularJS</category>
        
        <category>JavaScript</category>
        
      </item>
    
      <item>
        <title>How to dynamically get rss feed by using Javascript from a URL</title>
        <description>&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/08/banner-maddy.jpg&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/08/banner-maddy.jpg&quot; alt=&quot;How to dynamically get rss feed by using Javascript from a URL&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hi Friends, I wanna share my knowledge regarding “How to dynamically get rss feed by using Javascript from a URL” .&lt;/p&gt;

&lt;p&gt;I know most of you have knowledge about this , but i want to share my blog may it will help you more regarding this in very easiest way and more user friendly.&lt;/p&gt;

&lt;p&gt;In my blog , i will do the task in 3 steps basically.&lt;/p&gt;

&lt;p&gt;In first step,** i will go through the requirement and create a basic html for our requirement**.&lt;/p&gt;

&lt;p&gt;In second step, &lt;strong&gt;i will show you and describe you most about the java script for our objective&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In third step ,** i will show the output and the complete code for this**.&lt;/p&gt;

&lt;p&gt;So let me start with first step:&lt;/p&gt;

&lt;h2 id=&quot;step-1will-go-through-the-requirement-and-create-a-basic-html-for-our-requirement&quot;&gt;Step 1:will go through the requirement and create a basic html for our requirement&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Requirement :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Get News Feed by URL and Number of Feed to Fetch on Button Click Event&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To complete our requirement objective we need basically three files&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;index.html&lt;/li&gt;
  &lt;li&gt;main.js&lt;/li&gt;
  &lt;li&gt;style.css&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;so our folder structure looks like :&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Folder name (jsFeed)
- index.html
Folder name (js)
- main.js
Folder name (css)
- style.css
Folder name (images)
- loading.gif
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Let’s First create a basic html for this, as per our requirement we need 2 text boxes which represents respectively “Feed URL” , which takes input of rss feed url and the second text box html element will take “Number of Feed to Fetch”.&lt;/p&gt;

&lt;p&gt;Once , we create both of the text box element , i will create an event handler element by name button html element , which will perform the action when both of the inputs are available , by checking validation for both of the fields when click on button.&lt;/p&gt;

&lt;p&gt;So my first step to create an html for our requirement is as shown below :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;example&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Get News Feed by URL and Number of Feed to Fetch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Feed URL&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inputE&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;feedURL&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;feedURL&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;http://rss.news.yahoo.com/rss/topstories&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;placeholder=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Enter Feed URL&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;size=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;100&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&amp;lt;br&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Number of Feed Fetch&lt;span class=&quot;nt&quot;&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inputE&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fetchFeed&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;fetchFeed&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;placeholder=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Enter Number of Feed to Fetch&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;size=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;89&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;input&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;type=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;button&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;inputE&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getFeed&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getFeed&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Get Feed&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onclick=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;getFeed()&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt; 
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;I create an onclick event on button click and call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getFeed&lt;/code&gt; function of javascript , which is well known not defined yet , will be defined in step-2.&lt;/p&gt;

&lt;p&gt;As , I am thinking , when i get all feeds after placing my javascript code for this, i will get the result and i have to show this result also , so for this i have to create an html element also, where i will show the result.&lt;/p&gt;

&lt;p&gt;So, i am writing the result oriented html below , which will included in above html , in div element by class name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example&lt;/code&gt;.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;    
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;loading_rss&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;loading_feed&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;style=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;display:none;&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;img&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;alt=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Loading...&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;images/loading.gif&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;class=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;post_results&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;post_results1&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Did you get all the points and requirement defiend in Step-1, if you are ok will this , than i will now move to step-2 , where i will write the js code for the above.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/08/How-to-dynamically-get-rss-feed-by-using-Javascript-from-a-URL-1.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/08/How-to-dynamically-get-rss-feed-by-using-Javascript-from-a-URL-1.png&quot; alt=&quot;How to dynamically get rss feed by using Javascript from a URL 1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;step-2-will-show-you-and-describe-you-most-about-the-java-script-for-our-objective&quot;&gt;Step-2: will show you and describe you most about the java script for our objective.&lt;/h2&gt;

&lt;p&gt;In step-2 , we will discuss how i will perform validation before getting rss feed and how i will get rss feed , if validation are successfully completed on button click event and calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getFeed&lt;/code&gt; method as defined in html in step-1.&lt;/p&gt;

&lt;p&gt;So lets start with creating in javascript function in our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;main.js&lt;/code&gt; file by name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;getFeed&lt;/code&gt;
and checking the value of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;feedURL&lt;/code&gt; and fetchFeed text box’s values if these are filled
then call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rssReader.init&lt;/code&gt; function by passing the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;url&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;id&lt;/code&gt; of the div element in which we have to show the desired result or feeds.&lt;/p&gt;

&lt;p&gt;Our &lt;strong&gt;getFeed&lt;/strong&gt; function looks like:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;    &lt;span class=&quot;c1&quot;&gt;//getFeed method called when getFeed button is clicked&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;getFeed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// get the value of feedURL&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;feedURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;feedURL&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
    &lt;span class=&quot;c1&quot;&gt;// get the value of number of Feed to fetch.&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fetchFeed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;fetchFeed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; 
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;feedURL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Please Enter Feed URL&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fetchFeed&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Please Enter Number of Feed to Fetch&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Show Loading image untill feed&apos;s not get&lt;/span&gt;
    
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;loading_feed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;block&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;encodeURIComponent&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;feedURL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;//Pass the feedUrl to google apis service to get feed from passed url with &lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;of&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;feed&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;fetch&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;context&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;element&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;where&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;to&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;place&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;googUrl&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&amp;amp;num=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;fetchFeed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;amp;q=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;amp;callback=rssReader.parse&amp;amp;context=post_results1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// intialize the rssReader function&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;rssReader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;post_results1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;googUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// let’s look about rssReader init function and parse the resultant data to the post result element and show.&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;rssReader&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;containers&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// initialization function&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;init&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;selector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;googUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// creating temp scripts which will help us to transform XML (RSS) to JSON&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;text/javascript&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;charset&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;utf-8&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;googUrl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;footer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// parsing of results by google&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;parse&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;context&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;innerHTML&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// creating list of elements&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;mainList&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;ul&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// also creating its childs (subitems)&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;entries&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;feed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;length&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;listItem&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;li&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; . &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;contentSnippet&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentSnippet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;contentSnippetText&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createTextNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentSnippet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;entries&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;_blank&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createTextNode&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// add link to list item&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;listItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;link&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;desc&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;p&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;desc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;contentSnippetText&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// add description to list item&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;listItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;desc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// adding list item to main list&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;mainList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;listItem&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;mainList&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;loading_feed&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;display&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;none&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;in rssReader we define 2 function , first one is init which is called when we complete validation step , and in this step we create a script tag element in which we pass the google api service to get rss feed url , which holds the information about&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;“number of feed to fetch”,&lt;/li&gt;
  &lt;li&gt;“feedurl from where we have to fetch url” ,&lt;/li&gt;
  &lt;li&gt;“call back function when this api will got result from the sending url” ,&lt;/li&gt;
  &lt;li&gt;“the element where we have to show the required result”.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;after initialization we parse the required output to out &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;post_result1&lt;/code&gt; div element and create dynamic ul , li listing with the required information like the&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Title of the news&lt;/li&gt;
  &lt;li&gt;Description about the news&lt;/li&gt;
  &lt;li&gt;Link to the news&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and append it, after append we hide the loading feed image which was loaded earlier on button click until we didn’t get the result, as we got the result, we will hide this element.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/08/How-to-dynamically-get-rss-feed-by-using-Javascript-from-a-URL2.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/08/How-to-dynamically-get-rss-feed-by-using-Javascript-from-a-URL2.png&quot; alt=&quot;How to dynamically get rss feed by using Javascript from a URL2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now , i would like to move to step-3 , where i will show you the complete code for this with output.&lt;/p&gt;

&lt;h2 id=&quot;step-3--will-show-the-output-and-the-complete-code-for-this&quot;&gt;step-3 : will show the output and the complete code for this.&lt;/h2&gt;

&lt;iframe src=&quot;http://embed.plnkr.co/VxLzwN/preview&quot; width=&quot;100%&quot; height=&quot;680px&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;allowfullscreen&quot;&gt;&lt;/iframe&gt;

&lt;p&gt;So , all of this i have done here to complete the requirement, i hope you all got very well my blog, if you got any question regarding this, you can send me comments on this
or if you like my post you can also share me your valuable feedback.&lt;/p&gt;

&lt;p&gt;Please check the complete source code by clicking the below button or to download.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/Maddyzone/dynamically-get-rss-feed-by-using-Javascript-from-a-URL&quot; target=&quot;_blank&quot;&gt; Download Code&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 04 Aug 2015 10:36:48 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/javascript/how-to-dynamically-get-rss-feed-by-using-javascript-from-a-url</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/javascript/how-to-dynamically-get-rss-feed-by-using-javascript-from-a-url</guid>
        
        <category>JavaScript</category>
        
        <category>rss</category>
        
        
        <category>JavaScript</category>
        
      </item>
    
      <item>
        <title>How to create dynamic button and text-box using JavaScript</title>
        <description>&lt;p&gt;Hi Friends, Today i am come here to share my knowledge with all of you regrading “How to create dynamic button and text box creations using javascript in efficient manner also get the value of each text box uniquely reference to there corresponding button and to submit all the text box value at once”.&lt;/p&gt;

&lt;p&gt;I hope you will like my this blog also as you did earlier for my past blogs.So lets start on my new blog &lt;strong&gt;“How to create dynamic button and text box creations using javascript”.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As a Backend End Developer, you may required dynamic creation of button and textbox simultaneously in website development which having form submission information , for like we want that user have to submit their skills in resume , so let we assume we didn’t know actually how many textbox we will define in our form by default for submission of skills , so we want that user will come to our resume registration form and their he/she will get the option to add number of skill as they want , so in this case we have to create this stuff dynamically , So now question arises how we can achieve this target before submission of form or on client side.&lt;/p&gt;

&lt;p&gt;So my friends i am presenting you the way of creation of buttons and textbox simultaneously using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;JavaScipt&lt;/code&gt; which is well known scripting language in our industry (IT) and this is also fast to process and provide results quickly.Now i am going to present the basic steps to achieve our goal , lets start with step first.&lt;/p&gt;

&lt;h2 id=&quot;step--1&quot;&gt;Step -1&lt;/h2&gt;

&lt;p&gt;In step-1 , i am going to create an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt; file where i will define a basic html for our goal as mention below the code presentation of my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt; :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-html&quot; data-lang=&quot;html&quot;&gt;    &lt;span class=&quot;nt&quot;&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Create dynamic button and text box creations using javascript&lt;span class=&quot;nt&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;script &lt;/span&gt;&lt;span class=&quot;na&quot;&gt;src=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;js/script.js&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;h2&amp;gt;&lt;/span&gt;Create dynamic button and text box creations using javascript&lt;span class=&quot;nt&quot;&gt;&amp;lt;/h2&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;div&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;object_data&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;button&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;add_button&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Add New&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;id=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;add_button&quot;&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;onclick=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;addButton()&quot;&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&amp;gt;&lt;/span&gt; Add New &lt;span class=&quot;nt&quot;&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;In the above code&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;I define a basic html for my file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html &lt;/code&gt;In folder under my system drive like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D:&lt;/code&gt; by folder name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example_1&lt;/code&gt; and place this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt; file there.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;I also create a folder name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;js&lt;/code&gt; inside folder &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example_1&lt;/code&gt; and place file by name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;script.js&lt;/code&gt; there.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Now , i will discuss about both of the file what these will do , so first move on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;indexhtml&quot;&gt;index.html&lt;/h3&gt;

&lt;p&gt;index.html , file basically present the view of our example, when we hit this file in our browser whatever just like in chrome , in body part of this html
i create a button control which call a java script function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addButton&lt;/code&gt; when we click on it , this function i will later define on our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;script.js&lt;/code&gt; file in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;js&lt;/code&gt; folder of this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;example_1&lt;/code&gt; folder and a blank div where all our dynamic control will appear after script called as a button and text box control.&lt;/p&gt;

&lt;p&gt;Are you ok till now, is everything clear now, If it is fine than i will move to my next step of for this blog.&lt;/p&gt;

&lt;p&gt;So lets start with next step by name step-2&lt;/p&gt;

&lt;h2 id=&quot;step--2&quot;&gt;Step -2&lt;/h2&gt;

&lt;p&gt;In step-2 , i will define the function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addButton&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;script.js&lt;/code&gt; file , which will dynamically add controls to our html blank div , having id attribute &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object_data&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Code for script.js is below :&lt;/p&gt;

&lt;h3 id=&quot;scriptjs&quot;&gt;script.js&lt;/h3&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// define global variable i to loop the button click event as much as we want&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;addButton&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;new_line&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;new_line_2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;br&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// these both of the lines will create dynamically new lines before putting any new textbox and button control.&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// create new text box control below using attribute of input type text box and assign name and id dynamically by using variable i defined as global variable above.&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;textbox&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;text&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;txt_&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;txtid&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;placeholder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;txt_&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;createElement&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;button&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Click Me&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// assign click event for each new button element created dynamically using attribiute of input type button and assign name and id dynamically using variable i defined as global variable above.&lt;/span&gt;
    
    &lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setAttribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;onClick&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;showMessage()&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;//on click on every newly created button a &quot;showMessage&quot; javascript function will call, which will show us the value of their corresponding text box.&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// assign both of these textbox and button controls to blank div by id &quot;object_data&quot; in html document using below code.&lt;/span&gt;
    
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;object_data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;textbox&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;object_data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;btn&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;object_data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;new_line&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;object_data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;appendChild&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;new_line_2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    
    &lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;++&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;//increment the counter&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;The above code will do our motto in a manner , when we click on button add new , the JavaScript function &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;addButton&lt;/code&gt; will called , as defined above this function will dynamically create all four element and append to our html blank div by id &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object_data&lt;/code&gt; respectively textbox, button, and two break lines , and append as much controls as much or how many times i will hit the add new button.&lt;/p&gt;

&lt;p&gt;So, how you feel now my friends ,is its easier for you all to create all this stuff, now if you understand all this i wanna move to my next step of my blog by name step-3 which will present you the way how you can get the values of each dynamically created text box on button click.&lt;/p&gt;

&lt;p&gt;so as you know , as i write earlier in above code a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;showMessage&lt;/code&gt; function will call as you click on dynamically created button , this function will do the rest of the work for step-3&lt;/p&gt;

&lt;h3 id=&quot;step--3&quot;&gt;Step -3&lt;/h3&gt;

&lt;p&gt;Code for showMessage function :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;    &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;showMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(){&lt;/span&gt;
    &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;currID&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;showMessage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;caller&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;arguments&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// this statement will returns us the value ofid attribute of button on which we currently click among dynamically created buttons.&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;// this &quot;document.getElementById(&quot;txt&quot;+currID).value&quot; statement , will get the value of corresponding text box to button on behalf of &quot;id&quot; attribute.&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;alert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;getElementById&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;txt&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;currID&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;err&quot;&gt; &lt;/span&gt;
    &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;So, now using all the above code and below url for complete code, you can create dynamic controls to html using javascript easily.&lt;/p&gt;

&lt;p&gt;for any query , please comment me or feedback me for this blog , how do you like this.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/Maddyzone/create-dynamic-button-and-text-box-using-javascript&quot; target=&quot;_blank&quot;&gt; Code&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 21 Jul 2015 16:49:52 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/javascript/create-dynamic-button-and-text-box-using-javascript</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/javascript/create-dynamic-button-and-text-box-using-javascript</guid>
        
        <category>dynamic button</category>
        
        <category>dynamic textbox</category>
        
        <category>JavaScript textbox</category>
        
        
        <category>JavaScript</category>
        
      </item>
    
      <item>
        <title>Basic searching in AngularJS</title>
        <description>&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/07/Basic-search-in-angularjs.jpg&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/07/Basic-search-in-angularjs.jpg&quot; alt=&quot;Basic searching in AngularJS&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Today I will describe that How we will do basic searching in AngularJS.For this we need Following File structure.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;index.html     // in this we will define our all structure
script.js      // in this our all angular code
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In this we use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Bootstrap&lt;/code&gt; for styling purpose and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;angular.js&lt;/code&gt; to load angular in our page.&lt;/p&gt;

&lt;p&gt;For a Basic Searching in AngularJS first we make a module in Angular to activate angular in our page like below.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;var maddyApp= angular.module(&quot;maddyApp&quot;,[]);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then we make a controller to do our all things. In our case we are making an array of article  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;articleList&lt;/code&gt; with title , link and category like below. So&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;script.js&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;// Code goes here
var maddyApp= angular.module(&quot;maddyApp&quot;,[]);

maddyApp.controller(&apos;SearchingCtrl&apos;,[&apos;$scope&apos;,function($scope){
  // here we set some article data with title ,link and category of Maddyzone site :)
  
  $scope.articleList=[
    {
      &apos;title&apos;:&apos;conditionally apply classes in angularjs&apos;,
      &apos;link&apos;:&apos;http://maddyzone.com/javascript/conditionally-apply-classes-in-angularjs&apos;,
      &apos;category&apos;:&apos;Angular&apos;
    },{
      &apos;title&apos;:&apos;Dynamic routing with AngularJS&apos;,
      &apos;link&apos;:&apos;http://maddyzone.com/javascript/dynamic-routing-angularjs&apos;,
      &apos;category&apos;:&apos;Angular&apos;
    },{
      &apos;title&apos;:&apos;How to use multiple ng-view in a single page&apos;,
      &apos;link&apos;:&apos;http://maddyzone.com/javascript/use-multiple-ng-view-single-page&apos;,
      &apos;category&apos;:&apos;Angular&apos;
    },{
      &apos;title&apos;:&apos;How to Setup Node.js on Amazon EC2&apos;,
      &apos;link&apos;:&apos;http://maddyzone.com/resources/how-to-setup-node-js-amazon-ec2&apos;,
      &apos;category&apos;:&apos;Node&apos;
    },{
      &apos;title&apos;:&apos;How to add Google search in our website&apos;,
      &apos;link&apos;:&apos;http://maddyzone.com/resources/add-google-search-website&apos;,
      &apos;category&apos;:&apos;Google&apos;
    }
    ];
  
}]);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now talk about our HTML file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;index.html&lt;/strong&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html ng-app=&quot;maddyApp&quot;&amp;gt;

&amp;lt;head&amp;gt;
  &amp;lt;!--load bootstrap for styling --&amp;gt;
  &amp;lt;link data-require=&quot;bootstrap-css@3.1.0&quot; data-semver=&quot;3.1.0&quot; rel=&quot;stylesheet&quot; href=&quot;//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css&quot; /&amp;gt;
  &amp;lt;!-- load angular.js --&amp;gt;
  &amp;lt;script data-require=&quot;angular.js@1.3.17&quot; data-semver=&quot;1.3.17&quot; src=&quot;https://code.angularjs.org/1.3.17/angular.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;!-- in the script.js our all angular code --&amp;gt;
  &amp;lt;script src=&quot;script.js&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
  &amp;lt;div class=&quot;container&quot; ng-controller=&quot;SearchingCtrl&quot;&amp;gt;
    &amp;lt;div class=&quot;jumbotron&quot;&amp;gt;
      &amp;lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2013/10/maddyzone-logo-300x72.png&quot;&amp;gt;
      &amp;lt;br/&amp;gt;
      &amp;lt;h1&amp;gt;Basic Searching With AngularJS&amp;lt;/h1&amp;gt;
      &amp;lt;br/&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;form&amp;gt;
      &amp;lt;label&amp;gt;Search &amp;lt;/label&amp;gt;
      &amp;lt;input type=&quot;text&quot; ng-model=&quot;search&quot; /&amp;gt;
    &amp;lt;/form&amp;gt;

    &amp;lt;table class=&quot;table&quot;&amp;gt;
      &amp;lt;thead&amp;gt;

        &amp;lt;tr&amp;gt;
          &amp;lt;th colspan=3 align=&quot;center&quot;&amp;gt;
            Search With &amp;lt;i&amp;gt;&quot;&quot;&amp;lt;/i&amp;gt;
          &amp;lt;/th&amp;gt;
        &amp;lt;/tr&amp;gt;
        &amp;lt;tr&amp;gt;
          &amp;lt;th&amp;gt;
            S.N.
          &amp;lt;/th&amp;gt;
          &amp;lt;th&amp;gt;
            Title (click on link to view)
          &amp;lt;/th&amp;gt;
          &amp;lt;th&amp;gt;Category&amp;lt;/th&amp;gt;
        &amp;lt;/tr&amp;gt;

      &amp;lt;/thead&amp;gt;
      &amp;lt;tbody&amp;gt;

        &amp;lt;tr ng-repeat=&quot;(key,value) in articleList | filter:search&quot;&amp;gt;
          &amp;lt;td&amp;gt;
            {{$index + 1}}
          &amp;lt;/td&amp;gt;

          &amp;lt;td&amp;gt;
            &amp;lt;a ng-href=&quot;value.link&quot; target=&quot;_blanck&quot;&amp;gt;&amp;lt;/a&amp;gt;
          &amp;lt;/td&amp;gt;

          &amp;lt;td&amp;gt;
            &amp;lt;label class=&quot;label label-info&quot;&amp;gt;&amp;lt;/label&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
        
        &amp;lt;tr ng-show=&quot;(articleList | filter:search).length == 0&quot;&amp;gt;
          
          &amp;lt;td colspan=&quot;3&quot;&amp;gt;
            &amp;lt;p&amp;gt;oops ! No Article found with this search&amp;lt;/p&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
      &amp;lt;/tbody&amp;gt;

    &amp;lt;/table&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now i am explaining above &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;index.html.&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&quot;set-a-search-box&quot;&gt;Set a Search Box&lt;/h2&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;form&amp;gt;
      &amp;lt;label&amp;gt;Search &amp;lt;/label&amp;gt;
      &amp;lt;input type=&quot;text&quot; ng-model=&quot;search&quot; /&amp;gt;
    &amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;First we set a input box and set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-model=&quot;search&quot; &lt;/code&gt; then we will use this in below section.&lt;/p&gt;

&lt;h2 id=&quot;show-article-list&quot;&gt;Show Article List&lt;/h2&gt;

&lt;p&gt;Show Article List With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$scope.articleList&lt;/code&gt; with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-repeat&lt;/code&gt; in a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;table &lt;/code&gt;here just ignore &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;filter:search&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-repeat&lt;/code&gt; we will discuss in next .Now you will see all article come in list in a table.&lt;/p&gt;

&lt;h2 id=&quot;filter-data-in-show-article-list&quot;&gt;Filter Data in Show Article List&lt;/h2&gt;

&lt;p&gt;Now when we apply &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;filter:search&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-repeat&lt;/code&gt; then it first take the input from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-model=&quot;search&quot; &lt;/code&gt; then search in All Article ListSection and show filter result .So Simple due to angular ;) .SO code you will see is like below&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;tr ng-repeat=&quot;(key,value) in articleList | filter:search&quot;&amp;gt;
          &amp;lt;td&amp;gt;
            {{$index + 1}}
          &amp;lt;/td&amp;gt;

          &amp;lt;td&amp;gt;
            &amp;lt;a ng-href=&quot;value.link&quot; target=&quot;_blanck&quot;&amp;gt;&amp;lt;/a&amp;gt;
          &amp;lt;/td&amp;gt;

          &amp;lt;td&amp;gt;
            &amp;lt;label class=&quot;label label-info&quot;&amp;gt;&amp;lt;/label&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;when-no-result-found&quot;&gt;When No Result Found&lt;/h2&gt;

&lt;p&gt;When we search thing which is not exist then we need to show a message for this we will apply below code by this we know that result is not found in articleList as per keyword in search input box.&lt;/p&gt;

&lt;p&gt;This below code &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(articleList | filter:search).length&lt;/code&gt; give us the filter result length.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(articleList | filter:search).length
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So our full code for not result found is below&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; &amp;lt;tr ng-show=&quot;(articleList | filter:search).length == 0&quot;&amp;gt;
          
          &amp;lt;td colspan=&quot;3&quot;&amp;gt;
            &amp;lt;p&amp;gt;oops ! No Article found with this search&amp;lt;/p&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;see-working-demo-below&quot;&gt;See Working Demo Below&lt;/h2&gt;

&lt;p&gt;Now  how to do search on some specific attribute like in this case  if want to search base on only &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;category&lt;/code&gt; then how we do .So we will see that how we do it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://embed.plnkr.co/vcjStDRmBKk6hfjOxm1e/preview&quot;&gt;Demo&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;search-with-category-name&quot;&gt;Search with category name&lt;/h2&gt;

&lt;p&gt;If we want to search with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;category&lt;/code&gt;  name then we need to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-repeat :filter by single field &lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then we need to apply &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ng-repeat&lt;/code&gt; with below logic.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ng-repeat=&quot;(key,value) in anydata | filter:{attribute-name:search-parameter}&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So here&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;anydata&lt;/code&gt; in our case is  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;articleList&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;attribute-name&lt;/code&gt; for which we want to search that is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;category &lt;/code&gt;in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;articleData&lt;/code&gt;&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;search-parameter&lt;/code&gt; is same is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;search&lt;/code&gt; from input searchbox&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So our final code will be for search by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;category&lt;/code&gt; is&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;        &amp;lt;tr ng-repeat=&quot;(key,value) in articleList | filter:{category:search}&quot;&amp;gt;
          &amp;lt;td&amp;gt;
            {{$index + 1}}
          &amp;lt;/td&amp;gt;

          &amp;lt;td&amp;gt;
            &amp;lt;a ng-href=&quot;value.link&quot; target=&quot;_blanck&quot;&amp;gt;&amp;lt;/a&amp;gt;
          &amp;lt;/td&amp;gt;

          &amp;lt;td&amp;gt;
            &amp;lt;label class=&quot;label label-info&quot;&amp;gt;&amp;lt;/label&amp;gt;
          &amp;lt;/td&amp;gt;
        &amp;lt;/tr&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;see-working-demo-for-filter-in-specific-attribute&quot;&gt;See Working Demo for filter in specific attribute&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;http://embed.plnkr.co/oDsM22dGJWDbNCEs1dmU/preview&quot;&gt;Demo&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Please give your comments and suggestion below.&lt;/p&gt;

&lt;p&gt;Thanks .&lt;/p&gt;
</description>
        <pubDate>Thu, 16 Jul 2015 15:09:19 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/angularjs/javascript/basic-searching-in-angularjs</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/angularjs/javascript/basic-searching-in-angularjs</guid>
        
        <category>Angular Js</category>
        
        <category>searching</category>
        
        
        <category>AngularJS</category>
        
        <category>JavaScript</category>
        
      </item>
    
      <item>
        <title>How to Add Multiple Products into WooCommerce Cart on Same Time using jQuery</title>
        <description>&lt;p&gt;Hello friends, In my new blog i am here to present you &lt;strong&gt;How to create Woocommerce cart with drag and drop and add to click functionality to Add multiple products into Woocommerce cart on the same time&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;As Title Saying to Add Multiple Products into Woocommerce Cart on Same Time , Questions arises in mind like :&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Why this is required ?&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;How we can achieve this ?&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Like for first question , i am answering you :&lt;/p&gt;

&lt;p&gt;If you are some how familiar with WooCommerce Plugin for Wordpress and uses their functionality in your websites based on Wordpress , you even check that , when we want to purchase some products from the shop page of that website , we will choose a product and click on add to cart, than for second time we again go to shop page choose a product and add to cart, so we have to switch between  cart page and product page for each time , to reduce this switching.&lt;/p&gt;

&lt;p&gt;I am here to present you very simple example to add multiple products from multiple product categories into cart and checkout on the same time.&lt;/p&gt;

&lt;p&gt;For second question “How we can achieve this ?” i am here to showing you with an example :&lt;/p&gt;

&lt;p&gt;are you get excited about this? so let’s start on this :&lt;/p&gt;

&lt;p&gt;We can achieve our motto in two ways :&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;Using Drag and Drop of products.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Using Add to Click on each Product item from category to add into cart.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In both of these ways , we need first of all the Woocommerce product category listing and also before going more on this we will first create a demo template file in our Wordpress themes folder on which we are currently working now by name like :&lt;/p&gt;

&lt;p&gt;by copying page.php into themes folder and rename it to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template-demo.php&lt;/code&gt; and assign the template name like “demo” in this file&lt;/p&gt;

&lt;p&gt;as :&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;?php

/* Template Name: Demo */

/* 
 *
 */

?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After this we will move to our first step here is :&lt;/p&gt;

&lt;h2 id=&quot;how-to-get-the-woocommerce-product-categories&quot;&gt;How to get the Woocommerce Product Categories.&lt;/h2&gt;

&lt;p&gt;To get these we will use the below statement in your php code:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$product_categories = get_terms( &apos;product_cat&apos; );
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you want to exclude some categories from all product categories you can use the below statement in your php code like:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$product_cat_list = array(
             &apos;exclude&apos;    =&amp;gt; &apos;29,31,32&apos;
);
$product_categories = get_terms( &apos;product_cat&apos;, $product_cat_list );
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This statement will returns you all WooCommerce products categories listing in form of array.&lt;/p&gt;

&lt;p&gt;When we get all categories , now we have to get all products listing for each of the category, to achieve this we will go to our next step :&lt;/p&gt;

&lt;h2 id=&quot;how-to-get-all-of-the-products-from-each-of-the-woocommerce-product-categories&quot;&gt; How to get all of the products from each of the Woocommerce Product Categories.&lt;/h2&gt;

&lt;p&gt;To achieve this , we can use the below code snippet in our template file after the code of get all products categories array.First we will create a button to add all dragged products into cart by using the below html snippet.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_1.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_1.png&quot; alt=&quot;screenshot_1&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;div class=&quot;demo_cart_controls&quot;&amp;gt;

   &amp;lt;input type=&quot;button&quot; id=&quot;mul_add_cart&quot; value=&quot;Proceed to Cart&quot;/&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Secondly we will create a division or section of page in left side in which we have to show all WooCommerce products by category using the code snippet.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;div id=&quot;options&quot;&amp;gt;

&amp;lt;div id=&quot;all_products&quot;&amp;gt;

&amp;lt;h3&amp;gt; All Products &amp;lt;/h3&amp;gt;

&amp;lt;div id=&quot;accordion_product&quot;&amp;gt;

&amp;lt;?php foreach($product_categories as $key=&amp;gt;$value){

                  $prod_category = $value-&amp;gt;slug;?&amp;gt;

&amp;lt;h3&amp;gt;&amp;lt;?php echo $prod_category;?&amp;gt;&amp;lt;/h3&amp;gt;

&amp;lt;div  class=&quot;acc_individual&quot;&amp;gt;

  &amp;lt;p&amp;gt;

&amp;lt;?php $args = array( &apos;post_type&apos; =&amp;gt; &apos;product&apos;,&apos;product_cat&apos; =&amp;gt; $prod_category , &apos;orderby&apos; =&amp;gt; &apos;rand&apos; );

        $loop = new WP_Query( $args );

        while ( $loop-&amp;gt;have_posts() ) : $loop-&amp;gt;the_post(); global $product; ?&amp;gt;

                &amp;lt;div class=&quot;drag&quot; id=&quot;&amp;lt;?php echo &apos;drag&apos;.$post-&amp;gt;ID;?&amp;gt;&quot;&amp;gt;   

                    &amp;lt;a href=&quot;#&quot; title=&quot;&amp;lt;?php echo esc_attr($loop-&amp;gt;post-&amp;gt;post_title ? $loop-&amp;gt;post-&amp;gt;post_title : $loop-&amp;gt;post-&amp;gt;ID); ?&amp;gt;&quot;&amp;gt;

                        &amp;lt;?php woocommerce_show_product_sale_flash( $post, $product ); ?&amp;gt;

                        &amp;lt;?php if (has_post_thumbnail( $loop-&amp;gt;post-&amp;gt;ID )) echo get_the_post_thumbnail($loop-&amp;gt;post-&amp;gt;ID, &apos;shop_catalog&apos;); else echo &apos;&amp;lt;img src=&quot;&apos;.woocommerce_placeholder_img_src().&apos;&quot; alt=&quot;Placeholder&quot; width=&quot;300px&quot; height=&quot;300px&quot; /&amp;gt;&apos;; ?&amp;gt;

                                    &amp;lt;div class=&quot;ui-drag-detail&quot;&amp;gt;

                        &amp;lt;h3&amp;gt;&amp;lt;?php the_title(); ?&amp;gt;&amp;lt;/h3&amp;gt;

                        &amp;lt;span class=&quot;price&quot;&amp;gt;&amp;lt;?php echo $product-&amp;gt;get_price_html(); ?&amp;gt;&amp;lt;/span&amp;gt;

                        &amp;lt;span class=&quot;add_drag_prod&quot;&amp;gt;

                          &amp;lt;input type=&quot;button&quot;  class=&quot;add_cart_prod&quot; id=&quot;&amp;lt;?php echo &apos;add_id&apos;.$post-&amp;gt;ID;?&amp;gt;&quot; rel_id=&quot;&amp;lt;?php echo $post-&amp;gt;ID;?&amp;gt;&quot; value=&quot;+&quot; onclick=&quot;jQuery(this).add_prod(&amp;lt;?php echo $post-&amp;gt;ID;?&amp;gt;);&quot;&amp;gt;

                            &amp;lt;/span&amp;gt;

                        &amp;lt;span class=&quot;delete_drag_prod&quot;&amp;gt;

                          &amp;lt;input type=&quot;button&quot;  class=&quot;del_cart_prod&quot; id=&quot;&amp;lt;?php echo &apos;del_id&apos;.$post-&amp;gt;ID;?&amp;gt;&quot; rel_id=&quot;&amp;lt;?php echo $post-&amp;gt;ID;?&amp;gt;&quot; value=&quot;X&quot; onclick=&quot;jQuery(this).del_prod(&amp;lt;?php echo $post-&amp;gt;ID;?&amp;gt;);&quot;&amp;gt;

                               &amp;lt;/span&amp;gt;

                                    &amp;lt;/div&amp;gt;

                    &amp;lt;/a&amp;gt;

                    &amp;lt;?php woocommerce_template_loop_add_to_cart( $loop-&amp;gt;post, $product ); ?&amp;gt;

                &amp;lt;/div&amp;gt;

    &amp;lt;?php endwhile; ?&amp;gt;

    &amp;lt;?php wp_reset_query(); ?&amp;gt;

     &amp;lt;/p&amp;gt;

        &amp;lt;/div&amp;gt;

    &amp;lt;?php } ?&amp;gt;

    &amp;lt;/div&amp;gt;

    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The above code will returns you , the list of all products with their details like product image , product name , price etc. in response to each of the category.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_2.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_2.png&quot; alt=&quot;screenshot_2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As We got all products regarding each category in one part of the demo page template , now we create a second part of the page which we call &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt; , where we will drag and drop products to cart from first dragged area.&lt;/p&gt;

&lt;p&gt;so i am going to write the below html code snippet for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt; which will added just below the above code snippet.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &amp;lt;div id=&quot;frame&quot;&amp;gt;
       &amp;lt;span id=&quot;title&quot;&amp;gt;&amp;lt;h3&amp;gt;  Drop your Products to Cart Here&amp;lt;/h3&amp;gt;&amp;lt;/span&amp;gt;
        &amp;lt;table id=&quot;tbldevs&quot; border=&quot;1&quot;&amp;gt;          
        &amp;lt;/table&amp;gt;
     &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_3.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_3.png&quot; alt=&quot;screenshot_3&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if you get all understanding of :&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;a) To get all Woo Commerce products categories&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;b) To get all Woo Commerce products category product listing with their detail in dragged area successfully we are able to move to over next stage of this blog which is our objective to add multiple products into&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt; which we will achieve using jQuery. So as we finish half of the part , we are now move to another half by writing jQuery for drag and drop functionality for first way to achieve our motto.&lt;/p&gt;

&lt;p&gt;So now i am going to write jQuery code after footer section of template page by name &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;template-demo.php&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;

   jQuery(document).ready(function($){       

        counter = 0;

            var total_ids_string = [];

            // accordion section

            $(&quot;#accordion_individual&quot;).accordion({active: false , collapsible: true});

            // Drop Products to &quot;Cart Area&quot; Section Start

        //Make element draggable

        $(&quot;.drag&quot;).draggable({

            helper:&apos;clone&apos;,

            containment: &apos;frame&apos;,

            //When first dragged

            stop:function(ev, ui) {

                  var pos=$(ui.helper).offset();

                  objName = &quot;#clonediv&quot;+counter

                  $(objName).css({&quot;left&quot;:0,&quot;top&quot;:0});

                  $(objName).removeClass(&quot;drag&quot;);

                  //When an existiung object is dragged

                $(objName).draggable({

                  containment: &apos;parent&apos;,

                    stop:function(ev, ui) {

                        var pos=$(ui.helper).offset();

                        console.log($(this).attr(&quot;id&quot;));

                                    console.log(pos.left)

                        console.log(pos.top)

                    }

                });

            }

        });

        //Make element droppable

        $(&quot;#frame&quot;).droppable({

                  drop: function(ev, ui) {

                        if (ui.draggable.attr(&apos;id&apos;).search(/drag[0-9]/) != -1){

                              var did = ui.draggable.attr(&apos;id&apos;);

                              var title = $(&quot;#&quot;+did).children(&apos;a&apos;).attr(&apos;title&apos;);                          

                            var firstwords = title.split(&quot; &quot;);

                              counter++;

                              var element=$(ui.draggable).clone();

                              element.addClass(&quot;tempclass&quot;);

                              $(this).append(element);

                              $(&quot;.tempclass&quot;).attr(&quot;id&quot;,&quot;clonediv&quot;+counter);

                              $(&quot;#clonediv&quot;+counter).removeClass(&quot;tempclass&quot;);

                              //Get the dynamically added product id

                              draggedNumber = ui.draggable.attr(&apos;id&apos;).search(/drag([0-9])/)

                              // Get the ID of latest added product into &quot;Cart area&quot;.

                              var latestID = $(&quot;#clonediv&quot;+counter).children(&apos;a.add_to_cart_button&apos;).attr(&apos;data-product_id&apos;);

                              // Create an array of all products ID in Cart Area

                              total_ids_string.push(latestID);

                              // Print All Products ID&apos;s in Cart Area to console for confirmation.

                              console.log(total_ids_string);           

                              itemDragged = &quot;dragged&quot; + RegExp.$1

                              $(&quot;#clonediv&quot;+counter).addClass(itemDragged);

                        }
            }
        });
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here As we got list of products from dragged area to cart area which we want to add into cart from cart area , now we will create an jQuery action on button click, define above to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Add to Cart&lt;/code&gt; all the products which are in cart area by using below code snippet.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; $(&quot;#mul_add_cart&quot;).on(&apos;click&apos;,function(){

            // Firstly we will check if the &quot;Cart Area&quot; have any product in it while adding products by using the below code snippet

                           if(total_ids_string.length==0){                            

                                 alert(&quot;There is no product choosen to add into cart &quot;);

                                 // if length is &quot;0&quot; then show alert that &quot;There is no product choosen to add into cart &quot; otherwise move to else part as below

                           }else{

                                  $(&quot;.response&quot;).css(&apos;display&apos;,&apos;block&apos;);     

                                    $(&quot;.response&quot;).delay(8000).fadeOut(&apos;slow&apos;);

                                    setTimeout(function(){

                                     window.location.href=&quot;http://localhost/maddyzone_test/cart/&quot;;

                                    },2000);
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Motto is come here where we will create an loop upto the length of array of product ID’s in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt; and send an ajax request by using post method to WordPress ajax request page by url as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://localhost/maddyzone_test/wp-admin/admin-ajax.php&lt;/code&gt;   having parameters “&lt;strong&gt;action&lt;/strong&gt;, &lt;strong&gt;productID **, **quantity&lt;/strong&gt;” in the form of object.&lt;/p&gt;

&lt;p&gt;When this request is complete for all of the products in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt; we will auto redirected to cart page , where will get all of the products listing which we added in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt;. Define cart page url in url attribute and window.location.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;                for (var i=0; i&amp;lt;total_ids_string.length; i++) {

                                          if(total_ids_string[i]!== &apos;undefined&apos;){

                                                var myKeyVals = { action: &quot;woocommerce_add_to_cart&quot;, product_id: total_ids_string[i] , quantity: 1}

                                                 $.ajax({

                                                        type: &apos;POST&apos;,

                                                        url: &quot;http://localhost/maddyzone_test/cart/&quot;,

                                                        data: myKeyVals,

                                                        dataType: &quot;text&quot;,

                                                        async: false,

                                                        success: function(resultData) {

                                                        console.log(&quot;Save Complete&quot;) ;

                                                        }

                                                });              

                                          }

                                    }

                           }

            });

    });

      &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So by using all these stuff we will get our motto by using the one method drag and drop functionality using jQuery.&lt;/p&gt;

&lt;p&gt;By click on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Proceed to Cart&lt;/code&gt; button after adding product to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Cart Area&lt;/code&gt; below screen will show.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_4.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_4.png&quot; alt=&quot;screenshot_4&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you are now redirecting to your cart page, as you get cart page you will see your added product there in cart as shown in below screen.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_5.png&quot;&gt;&lt;img src=&quot;http://tech-blog.maddyzone.com/uploads/2015/06/screenshot_5.png&quot; alt=&quot;screenshot_5&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we have to make some more customization on the above like&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;a) Delete product from cart area.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;b) Remove All of the product at once from cart area.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;c) Styling the popup’s&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All these extra things we will get in knowledge , from the next part of this blog for drag and drop functionality then move to click functionality.&lt;/p&gt;
</description>
        <pubDate>Mon, 22 Jun 2015 05:35:39 +0000</pubDate>
        <link>http://tech-blog.maddyzone.com/jquery/php/wordpress/add-multiple-products-woocommerce-cart-time-using-jquery</link>
        <guid isPermaLink="true">http://tech-blog.maddyzone.com/jquery/php/wordpress/add-multiple-products-woocommerce-cart-time-using-jquery</guid>
        
        <category>Drag and Drop</category>
        
        <category>WooCommerce</category>
        
        
        <category>jQuery</category>
        
        <category>Php</category>
        
        <category>Wordpress</category>
        
      </item>
    
  </channel>
</rss>
