ajax在提交时在空间上创建%20 ....

时间:2014-03-21 04:16:18

标签: javascript php ajax

PHP:

<div id="PROJECT_ENTRY" style="display:none">
                            <table align="center">
                                <tr><td>PROJECT ID:</td><td class="PROJECT_ID" ><input id="PROJECT_ID"  name="PROJECT_ID" class="PROJECT_ID" ></td></tr>
                                <tr><td>PROJECT NAME:</td><td class="PROJECT_NAME" ><input id="PROJECT_NAME"  name="PROJECT_NAME" class="PROJECT_NAME" ></td></tr>
                            </table>    
                        </div>
<td width="80px"><a href="javascript:projectform()"><img src="<?php echo base_url(); ?>./images/addDetal.png" style='vertical-align:middle;' width='23' height='23' /></a></td>

 function projectform(){
                    $("#PROJECT_ENTRY").dialog({ 
                    modal: true,
                    width:400,
                    title:'NEW PROJECT ENTRY',
                    buttons: {
                         OK: function(){
                              var projectID=$("#PROJECT_ID").val();
                              var projectname=$("#PROJECT_NAME").val();

     var  baseUrl= "<?php echo base_url() . 'LOANENTRY/operate_project/'; ? "+projectID+'/'+projectname;

              $.ajax({
                cache: false,
                type: "POST",
                url: baseUrl,
                data: $('#PROJECT_ENTRY').serialize(),
                dataType: "html",
                success: function() {                     

                }
            });
              $(this).dialog( "close" );
                        },
                    CANCEL: function() {
                        $(this).dialog( "close" );
                    }
                }
            });
        } 

2 个答案:

答案 0 :(得分:0)

你可能需要

$.ajax({
   cache: false,
   type: "POST",
   url: baseUrl,
   data: "project_entry="+$('#PROJECT_ENTRY').val(),
   dataType: "html",
   success: function() {                     

   }
});

接收这个PHP:

$p_entry = $_POST['project_entry'];

答案 1 :(得分:0)

您可以使用urldecode()

删除php中的%20