Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- $(document).ready(function () {
- var id = $("#service").val();
- var user = $("#CUsers_id").val();
- var copy = "<?php echo $copy; ?>";
- var csrf = "<?php echo Yii::app()->request->csrfToken; ?>";
- $.ajax({
- type: "POST",
- url: "/request/setfields2",
- data: {"id": id, "YII_CSRF_TOKEN": csrf},
- dataType: "text",
- cache: false,
- update: "#fields",
- error: function (e) {
- console.log(e);
- },
- success: function (data) {
- $("#fields").css({'display': 'block'});
- $("#fields").html(data);
- if (copy != true && user) {
- $.ajax({
- type: "POST",
- url: "/request/getservices",
- data: {"user":user, "YII_CSRF_TOKEN":csrf},
- dataType: "json",
- cache: false,
- error: function(e) {
- console.log(e);
- },
- success: function(json) {
- $("#service").html("");
- $("#service").append("<option></option>");
- $.each(json, function(index, value) {
- $("#service").append(
- "<option value=\"" + json[index].id + "\">" + json[index].text + "</option>"
- );
- });
- $("#service").val(id);
- $.ajax({
- type: "POST",
- url: "/request/contracts",
- data: {"user":user, "YII_CSRF_TOKEN":csrf},
- dataType: "json",
- cache: false,
- error: function(e) {
- console.log(e);
- },
- success: function(json) {
- $("#contract").html("");
- $("#contract").append("<option></option>");
- $.each(json.contracts, function(index, value) {
- $("#contract").append(
- "<option value=\"" + json.contracts[index].id + "\">" + json.contracts[index].text + "</option>"
- );
- });
- $("#contract").change();
- }
- });
- }
- });
- }
- }
- });
- });
- </script>
Add Comment
Please, Sign In to add comment