小编mva*_*sco的帖子

在Ajax函数之后没有数据传递给URL

这是我用来使用Ajax将参数传递给另一个PHP页面的脚本.

 $(document).on( "click",".btndriver", function() {

      var id = $(this).attr("id");

      var nombre = $(this).attr("nombre");
      var url = "ondemand_driver.php";
      swal({   
        title: "Select Driver?",   
        text: "Select Driver? : "+nombre+" ?",   
        type: "warning",   
        showCancelButton: true,   
        confirmButtonColor: "#DD6B55",   
        confirmButtonText: "GO",   
        closeOnConfirm: true }, 
        function(){   
          var value = {
            'id': id
          };
          $.ajax(

          {
            url : "ondemand_driver.php",
            type: "POST",
            data : value,
            success: function() {

              window.location=url
            }
          });
        });
    });
Run Code Online (Sandbox Code Playgroud)

但现在网址没有收到任何参数.

为了检查它,我包括:

<?php echo $_POST['id'];?>
Run Code Online (Sandbox Code Playgroud)

在ondemand.driver.php,没有显示任何值.

我还检查了var id的值,它是45.

先感谢您.

javascript php ajax jquery

2
推荐指数
1
解决办法
164
查看次数

Firebase google-services.json文件

我对Firebase google-services.json文件有疑问。每次添加或更改某些内容时,例如,如果添加新的SHA1指纹,是否需要再次下载文件并将其放在Android项目的app文件夹中?还是仅是第一次创建的文件就足够了?

我问是因为我的电话身份验证有问题,我需要知道问题是否出在此问题上。

android firebase-authentication

2
推荐指数
1
解决办法
743
查看次数

指向整数转换'int'的指针不兼容,表达式为'id'

在我的应用程序中,我使用JSON从MySQL数据库中检索数据.

其中一个表字段是idCategoria,类型为整数.现在我尝试将idCategoria值分配给我的应用程序中的int变量,但这显示了编译器警告.我已经记录了categoriaID的值,它是143913536,但应该是1.

这是警告:

Incompatible pointer to integer conversion initializing 'int' with an expression of type 'id'
Run Code Online (Sandbox Code Playgroud)

这就是我试图这样做的方式:

 int categoriaID = [categoriaDescription objectForKey:@"idCategoria"];
Run Code Online (Sandbox Code Playgroud)

int nsdictionary ios

1
推荐指数
1
解决办法
6660
查看次数

将字符串显示为带有两个小数位的数字

在我的iOS应用程序中,我从远程服务器接收JSON数据.其中一个字段值可以是一个双数,如24.87,或一个int数,如24.现在我想在视图中显示数字,作为标签文本,但我希望总是得到一个2位小数,如例如,如果远程值是24,我想显示24.00 ...

我使用以下代码来执行此操作:

if ([tarifa_comanda isEqualToString:@"T1"]){
        cell.tarifa_label.text = @"T1";

        NSNumberFormatter * f = [[NSNumberFormatter alloc] init];
        [f setNumberStyle:NSNumberFormatterDecimalStyle];
        NSNumber * myNumber = [f numberFromString:[[categorias objectAtIndex:indexPath.row] objectForKey:@"precio1_plato"]];
        cell.precio_plato_label.text = myNumber;  

    }
Run Code Online (Sandbox Code Playgroud)

但我从数字输出错误.这是我得到的,标签是蓝色背景的标签:

在此输入图像描述

nsnumberformatter ios

1
推荐指数
1
解决办法
671
查看次数

从AppDelegate推送视图控制器

我刚刚开始学习如何使用iOS和Parse实现推送通知.目前,我可以从Parse仪表板向应用程序发送推送通知,收到通知,正如我在Xcode控制台中看到的那样,但现在我的问题是我无法从AppDelegate打开视图控制器.

这是我的代码:

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler {
    // Create empty photo object
    NSString *photoId = [userInfo objectForKey:@"p"];
    NSLog(@"P=%@",photoId);


    UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    Aceptado *targetViewController = (Aceptado*)[mainStoryboard instantiateViewControllerWithIdentifier:@"servicio_aceptado"];
    UINavigationController *controlador = [[UINavigationController alloc]init];
    [controlador pushViewController:targetViewController animated:YES];

    }
Run Code Online (Sandbox Code Playgroud)

正如我所说,控制台显示日志NSLog(@"P=%@",photoId),收到通知,但未显示视图控制器,显示任何警告或错误.

欢迎任何帮助.

apple-push-notifications ios appdelegate

1
推荐指数
1
解决办法
6406
查看次数

在Swift中比较字符串

我正在使用以下代码比较两个字符串,并根据比较显示不同的图像:

let sameQuotation = "0"
        if prioridad == sameQuotation {
            print("es 0-")
            let image11 = UIImage(named: "pri0") as UIImage?
        }


        let sameQuotation1 = "1"
        if prioridad == sameQuotation1 {
            print("es 1-")
            let image11 = UIImage(named: "pri1") as UIImage?
        }
Run Code Online (Sandbox Code Playgroud)

“打印”操作可以完美完成,但是图像不会改变。

我是Swift的新手,可能我的代码有问题。

谢谢。

ios swift

1
推荐指数
1
解决办法
1321
查看次数

将值从活动传递到选项卡

我正在开发一个新的Android项目.

第一个活动是使用滑块菜单和片段.在第一个片段上有一个列表视图(PrimaryFragmentDormir.java).选择其中一行后,将启动一个新活动.最后一个活动使用三个选项卡,以显示有关所选行对象的不同信息.listview是从远程JSON文件加载的.

这是PrimaryFragmentDormir.java中的onItemClick方法:

public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

        Hotel hotelActual = (Hotel) adapter.getItem(position);
        String msg = "Elegiste el hotel " + hotelActual.getNombre();
        Toast.makeText(getActivity(), msg, Toast.LENGTH_LONG).show();

        Intent intent = new Intent(getActivity(), Detalle_Hotel.class);

        intent.putExtra("id_hotel", hotelActual.getId_hotel());
        intent.putExtra("nombre_hotel", hotelActual.getId_hotel());
        intent.putExtra("descripcion_hotel", hotelActual.getId_hotel());
        intent.putExtra("latitud_hotel", hotelActual.getId_hotel());
        intent.putExtra("longitud_hotel", hotelActual.getId_hotel());
        intent.putExtra("direccion_hotel", hotelActual.getId_hotel());
        intent.putExtra("web_hotel", hotelActual.getId_hotel());
        intent.putExtra("tel_hotel", hotelActual.getId_hotel());
        intent.putExtra("tel_reservas", hotelActual.getId_hotel());
        intent.putExtra("foto_hotel", hotelActual.getId_hotel());
        intent.putExtra("calificacion_hotel", hotelActual.getId_hotel());
        intent.putExtra("num_estrellas", hotelActual.getId_hotel());
        intent.putExtra("zona_hotel", hotelActual.getId_hotel());
        intent.putExtra("facebook_hotel", hotelActual.getFacebook());
        intent.putExtra("twitter_hotel", hotelActual.getTwitter());


        startActivity(intent);




    }
Run Code Online (Sandbox Code Playgroud)

显示Toast并显示活动Detalle_Hotel.

Detalle_Hotel有三个标签.我需要的是从三个选项卡中的hotelActual获取值,以便单独使用它们.

这是Detalle_Hotel活动:

public class Detalle_Hotel extends AppCompatActivity {
    // Declaring …
Run Code Online (Sandbox Code Playgroud)

android android-fragments android-tabs

1
推荐指数
1
解决办法
2245
查看次数

使用CSS进行图像对齐

我有一个HTML输入用于搜索MySQL表上的项目.我必须说我是CSS新手.这是HTMP部分:

<div id="main">


        <div class="icon"></div>
        <h1 class="title">Especialidad Médica</h1>
        <h5 class="title">(selecciona la especialidad médica del doctor)</h5>

        <!-- Main Input -->
        <input type="text" id="search" autocomplete="off">

        <!-- Show Results -->
        <h4 id="results-text">Mostrando resultados para: <b id="search-string">Array</b></h4>
        <ul id="results"></ul>


    </div>
Run Code Online (Sandbox Code Playgroud)

这是CSS部分:

/******************************************************************
Main CSS
******************************************************************/
div#main {
    width: 360px;
    margin: 200px auto 20px auto;
}
.title {
    line-height: 1.2em;
    position: relative;
    margin-left: 40px;
}
div.icon {
    margin-top: 4px;
    float: left;
    width: 31px;
    height: 30px;
    background-image: url(../images/magnify.gif);
    background-repeat: no-repeat;
    -webkit-transition-property: background-position, color;
    -webkit-transition-duration: .2s, .1s; …
Run Code Online (Sandbox Code Playgroud)

html css php

1
推荐指数
1
解决办法
56
查看次数

带有文本和图标的 Android 警报对话框

我想要一个AlertDialog带有文本和图标的。我创建了两个数组,一个用于对话框项,另一个用于对话框项图标,但它不起作用。到目前为止,这是我的代码:

CharSequence options[] = new CharSequence[] {"RETEN", "ACCIDENTE VIAL", "INUNDACION", "ABUSO", "ASALTO / VIOLENCIA"};
builder = new AlertDialog.Builder(getActivity(), android.R.style.Theme_DeviceDefault_Settings);
builder.setCancelable(false);
Resources res = getResources();
TypedArray icons = res.obtainTypedArray(R.array.alertas);
builder.setIcon(icons);

builder.setTitle(getContext().getString(R.string.select_alert_type));
builder.setItems(options, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(DialogInterface dialog, int which) {
        // the user clicked on options[which]

        //1.RECUPERAR OPCION SELECCIONADA

        if (which == 0){ ... }

        ...

    });
Run Code Online (Sandbox Code Playgroud)

我在行收到警告:

builder.setIcon(icons);
Run Code Online (Sandbox Code Playgroud)

android

1
推荐指数
1
解决办法
2980
查看次数

Flutter 应用程序未初始化 Firebase 实例

我正在创建一个在 Firebase 中使用 Google 身份验证的 Flutter 应用程序。

用户可以使用 Google 登录,但是当用户再次启动应用程序时,我需要让用户保持登录状态。

这是我的 main.dart 代码

import 'package:flutter/material.dart';
import 'login_page.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {

  final FirebaseAuth _auth = FirebaseAuth.instance;

  Future<void> _checkUserStatusGoogle() async {
    await Firebase.initializeApp();
    _auth
        .authStateChanges()
        .listen((User user) {
      if (user == null) {
        print('User is currently signed out!');
      } else {
        print('User is signed in!');
      }
    });
  }


  @override
  void initState() {

      Firebase.initializeApp().whenComplete(() {
        _checkUserStatusGoogle().then((value) {
          print('Check done done');

    });
  });
  } …
Run Code Online (Sandbox Code Playgroud)

firebase-authentication flutter

1
推荐指数
1
解决办法
3438
查看次数