• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

phpmysqljquery-mobile


PHP Snippet 1:

header('Content-Type: application/json');
echo json_encode($data);

PHP Snippet 2:

$.each(data,function(index,item) 
{
    $('<option>').val(item.id).html(item.job_name).appendTo("#job_id");
});

Related Snippets

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

Elastic Beanstalk with Laravel Envoy

Dynamic table in HTML using MySQL and php

Laravel Factory not calling callback 'afterCreating'

Don't show recurring price for WooCommerce subscriptions worth 0$

MySQL upgrade causing unexpected results on simple WHERE clauses

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

Log a user out of a website when they put their computer to sleep

Can we define variables in `.tpl` files?

find in set in laravel ? example

Laravel print last executed SQL query with Query log

Laravel PHP: multiple project run at the same time [closed]

Implode array with array of glue strings

Render the content of default_filter.php in Joomla front-end

About Contact Privacy policy Terms and conditions