Results 1 to 3 of 3

Thread: Ext.Ajax.request params problem

  1. #1

    Default Ext.Ajax.request params problem

    Code:
     
    params = ''
    for(var i=0;i<IfieldName.length;i++){
     paramsValue = Ext.getDom(IfieldName[i]).value
     if(paramsValue==undefined){paramsValue=''}
     params = params+IfieldName[i]+':\''+paramsValue+'\','
    }
    params = params+'formID:\''+formID+'\''
    params = '[{'+params+'}]'
    //alert(params):"[{workFlowName:'??',workFlowDiv:'test',workFlowOrder:'1',formID:'5'}]"
    params = eval(params)
    //alert(params):object
    Ext.Ajax.request({
     url:"/DataOperate/exeFormInsert.asp", 
     params:params,
     success:function(response){
      eval(response.responseText)
      loadList(page)
      win.destroy();
     }
    })
    please tell me what's wrong whih this code~

    DataOperate/exeFormInsert.asp is fine
    when I user Jquery it's all ok~

    Code:
     
           params = ''
           for(var i=0;i<IfieldName.length;i++){
            paramsValue = Ext.getDom(IfieldName[i]).value
            if(paramsValue==undefined){paramsValue=''}
            params = params+IfieldName[i]+'='+paramsValue+'&'
           }
           params = params+'formID='+formID
           $.ajax({
            type:'post',
            url:"/DataOperate/exeFormInsert.asp", 
            data:params,
            dataType:'script',
            success:function(){
             loadList(page)
             win.destroy();
            }
           })

  2. #2

    Default

    You're giving us a piece of code, "to debug it for you," without so much as a hint of what is wrong with it?

    For one thing: parameters (and base-parameters or extra-parameters) should be expressed in your code as JavaScript objects. Ext is responsible for whatever encoding may be necessary.

    You do not have to, and should not, laboriously construct JSON-strings yourself. (When you actually have to do that, you have "Ext.encode()" and "Ext.decode().")

  3. #3
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    i agree with mike. If you don't speak english well, then post in your native language.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •