doutangxi2144 2015-06-18 05:11
浏览 61
已采纳

提交表单时,Post方法的行为类似于get方法

//db connect
    $server     = 'localhost';
    $username   = 'root';
    $password   = '';
    $database   = 'resort';
    $connect    = mysqli_connect($server, $username, $password ) or die(mysqli_error.'error connecting to db');
//select database
    mysqli_select_db ($database, $connect) or die(mysqli_error.'error selecting db');/*Jquery Function*/<script>
                    $(function(){
    //CONTACT FORM AJAX SUBMIT
    $('#contactForm').submit(function(){
          $.ajax({
        url:'mailer.php',
        type : 'POST',
        dataType: 'json',
        data: $(this).serialize(),
           success: function(data){
         if(data.error){
            $('#error').css('display','block');
        }else {
            $('#note').show();
            $('#error').hide();
            $(".contact-form").hide();
        }
    }
   });
   return false;
 });
});
                    </script>

Database ConnectivityContact Form
issue is that when i am trying to click on submit the webpage refreshes and the contents are shown in the url. Errors does not occur so no way to find out what the problem is. I am trying to build a contact form that can send mail. So you will also get some code related to it.The main issue is that why the page refreshes every time and why there is not any error if, database is connected or not,query written for insertion of data is correct or not, variables are correctly declared or not.

  • 写回答

2条回答 默认 最新

  • douyonglang4845 2015-06-18 05:16
    关注

    If your images are already in the right format then use Convert.ToBase64String Method (Byte[]) method to convert them to a base64 string and send this base64 string back.

    where you can use the string in the src attribute of the img tag to display the images. Which would be something like

    <img src=”data:<MIMETYPE>;base64,<BASE64_ENCODED_IMAGE>”>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写uniapp时遇到的问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流