php - Wordpress Using Ajax Jquery to reference custom post thumbnail -


ok, trying populate form featured image custom post type based on input of form field (in case - slug custom post type). can't seem around 500 internal server error when try access db external php script i'm using $wpdb class.

here's javascript:

function updateprevimage(did){     jquery("form .form-designdetails-front div#design-preview").html("put animated .gif here").show();     var thumbquery="/scripts/getdesignprev.php";     jquery.post(thumbquery,{designid:did},function(data){         jquery("form .form-designdetails-front div#design-preview").html(data).show();     }); }   jquery("#field_g6zk24").change(function(did){     var did=jquery("#field_g6zk24").val();     updateprevimage(did); }); 

i'm quite have jquery written properly. it's php that's problem think.

<?php   // design slug form field     //$designid=$_post['designid'];     require_once('../wp-blog-header.php');     $designid=$_post['designid'];     //$designid="sen-125-15";     // slug custom field if ( '' != $designid ) {     //get post id custom field slug     global $wpdb;     $my_id = $wpdb->get_var($wpdb->prepare("select id {$wpdb->posts} post_type='designs' , post_name = %s",$designid));     /*$args = array('name' => $designid, 'post_type' => 'designs');     $loop = new wp_query($args);         while ( $loop->have_posts() ) : $loop->the_post();              the_post_thumbnail();         endwhile;*/     //echo $designid;     // display post thumbnail.     $url = wp_get_attachment_url( get_post_thumbnail_id($my_id) );     echo $url; } ?> 

you can see page here: http://www.highschoolimpressions.com/order-form/?design_number=sen-125-15 window trying populate image in down in "front" section. right trying url image populate in there, can't that. understand jquery still needs modified display image.

any appreciated here. i'm @ roadblock here.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -