Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to grab query string values from jQuery Post?

Enthusiast ,
Mar 25, 2016 Mar 25, 2016

I have a jQuery that sends the data via post to my proxy ColdFusion page. However, in the this page, I'm not sure how to go about retrieving those values. I tried to log the following in my CFHTTP tag:

<cflog text="URL: #URL#" type="Information" file="CGIparameters">

<cflog text="URL-Name: #URL.name#" type="Information" file="CGIparameters">

But I always get this error:

"NetworkError: 500 Complex object types...erted to simple values. - https://devbox.mysite.com/customcf/kb/proxyPost-KB.cfm"

This is the JavaScript that's posting to the proxy page. However, I don't think there is anything wrong with the JavaScript. I tried putting static values in the CFHTTPPARAM and there is no errors. It was able to send the data to JSON API.

  1. $(function(){
  2.     $("##frmComment").submit(function(event){
  3.         event.preventDefault();
  4.         $("##submitResponse").append('<img src="../../../assets/mysite/img/ajax-loader.gif" class="progressGif">');
  5.         // Cache $form, we'll use that selector more than once
  6.         var $form=$(this);
  7.         var data = $form.serialize(); //get all the data of form
  8.         //post it
  9.         $.post(
  10.         "/customcf/kb/proxyPost-KB.cfm",
  11.         data,
  12.         //console.log(response),
  13.         function(response){
  14.             // Success callback.  Remove your progress gif, eg:
  15.             //$('body').removeClass('in-progress');
  16.             console.log(response);
  17.             // Remove the spining gif from the div
  18.             $("##submitResponse img:last-child").remove();
  19.             //Remove the feedback form
  20.             $("##frmComment").remove();
  21.             $form.fadeOut('slow', function(){
  22.                 //Add response text to the div
  23.                 $("##submitResponse").append("<h6>Thank you for your feedback.</h6>");
  24.                 $("##submitResponse").html(response).fadeIn('slow');
  25.             });
  26.         });
  27.     });
  28. })
513
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 25, 2016 Mar 25, 2016

They will be in the FORM or URL scope. This is a very basic question and there are many sources available to learn CF very quickly that you'll want to check out. Here is a thread with a couple: What is the best way to learn ColdFusion

Translate
Advocate ,
Mar 25, 2016 Mar 25, 2016

They will be in the FORM or URL scope. This is a very basic question and there are many sources available to learn CF very quickly that you'll want to check out. Here is a thread with a couple: What is the best way to learn ColdFusion

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 25, 2016 Mar 25, 2016
LATEST

Thanks! I forgot I was supposed to use form scope for post and url for get.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources