Skip to content

Instantly share code, notes, and snippets.

Created February 20, 2015 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/79c2f2a8f3797ad15c76 to your computer and use it in GitHub Desktop.
Save anonymous/79c2f2a8f3797ad15c76 to your computer and use it in GitHub Desktop.
using query ajax in Laravel 4.2
@extends('layouts.master')
@section('content')
<script>
$(document).ready(function () {
$('#send').click(function (e) {
alert(1111);
e.preventDefault();
$.ajax({
url: '{{url()}}/menu/menu',
type: 'POST',
cache: false,
data: $('form#add').serialize(),
dataType: 'json',
beforeSend: function () {
},
success: function (data) {
$("#result").append('<p>' + data + '</p>');
},
compelete:function(){
$("#result").append('<p>xxxxxxxxxxxxxxxxxxxxxxxxxx</p>');
}
error: function (xhr, textStatus, thrownError) {
alert('ops Errore');
}
});
});
});
</script>
<table class="table table-hover">
{{ Form::open(array('url'=>'menu/menu', 'id'=>'add')) }}
<tr>
<td>
{{ Form::label('ela3daa','المفتش') }}<br>
{{ Form::select('ela3daa',$ela3daa) }}
</td>
</tr>
<tr>
<td>
{{ Form::label('قائمة') }}<br>
{{ Form::select('menu' ,array(
'1/6/2014',
'24/12/2014'
), '3') }}
</td>
</tr>
<tr>
<td>
<h2>الاعضاء المعنيين بالتفتيش</h2>
</td>
</tr>
</table>
<table class="table table-hover">
<tr style="height: 50px; background: #f95; font-size: 18px; text-align: center;">
<td>
اسم المعني بالتفتيش
</td>
<td>
نيابة العمل
</td>
<td>
من
</td>
<td>
الى
</td>
<td>
المراجع
</td>
<td>
رئيس اللجنة
</td>
</tr>
<tr>
<td>{{ Form::select('el3do' ,array(
'احمد',
'تامر',
'محمد'
), '1') }}
</td>
<td>{{ Form::text("elnyaba") }}</td>
<td>{{ Form::input('date',"from") }}</td>
<td>{{ Form::input('date',"to") }}</td>
<td>{{ Form::text("elmorag3") }}</td>
<td>{{ Form::text("raees_ellagna") }}</td>
</tr>
<tr>
<!--<td>{{ Form::submit('تسجيل البيانات للمفتش', array('class'=>'btn btn-primary col-lg-3')) }}</td>-->
<td>{{ Form::button('Send',array('class'=>'btn btn-success','id'=>'send')) }}</td>
</tr>
</table>
{{ Form::close() }}
<p id="result">aaaaa</p>
@stop
<?php
class MenuController extends \BaseController {
public function getMenumofatesh() {
return View::make('menu.menu')
->with('ela3daa', BasicData::ela3daa())
->with('list_ela3daa', BasicData::list_ela3daa());
}
public function postMenu() {
echo '<pre>';
$Elmaaneenbeltaftesh = new Elmaaneenbeltaftesh;
$elmofatesh = Input::get('ela3daa');
$esm_elmaaneebeltaftesh = Input::get('esm_elmaaneebeltaftesh');
$elnyaba = Input::get('elnyaba');
$from = Input::get('from');
$to = Input::get('to');
$elmorag3 = Input::get('elmorag3');
$raees_ellagna = Input::get('raees_ellagna');
$all[] = array(
'el_mofatesh' => $elmofatesh,
'esm_elmaaneebeltaftesh' => $esm_elmaaneebeltaftesh,
'elnyaba' => $elnyaba,
'from' => $from,
'to' => $to,
'elmorag3' => $elmorag3,
'raees_ellagna' => $raees_ellagna
);
echo '</pre>';
return Response::json('anything');
/*
$check = DB::table('elmaaneenbeltaftesh')->insert($all);
if ($check) {
return Redirect::to('menu/menumofatesh');
}else{
return 'noooooooooooooo';
}
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment